| 1 | <?php
|
|---|
| 2 | require_once( dirname(__file__) . '/../common/omconfig.php' );
|
|---|
| 3 |
|
|---|
| 4 | if (defined('OMCOLLAB_CACHE_KEY'))
|
|---|
| 5 | {
|
|---|
| 6 | $supplied_key = (isset($_GET['key'])) ? htmlspecialchars($_GET['key']) : '';
|
|---|
| 7 | if ($supplied_key == ''||trim($supplied_key) != trim(OMCOLLAB_CACHE_KEY))
|
|---|
| 8 | {
|
|---|
| 9 | echo 'no permission';
|
|---|
| 10 | exit;
|
|---|
| 11 | }
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | require_once( dirname(__file__) . '/../common/json_service.php' );
|
|---|
| 16 | require_once( FS_COMMON_SKIN_DIRECTORY . '/common.php' );
|
|---|
| 17 | require_once( FS_COMMON_DIRECTORY.'/utils.php');
|
|---|
| 18 | require_once(dirname(__file__) . '/contribution/contributionStatistics.php');
|
|---|
| 19 | require_once('includes/config.php');
|
|---|
| 20 | require_once ('includes/classes/DB.php' );
|
|---|
| 21 | require_once(dirname(__file__) . '/contribution/teamContributionStatistic.php');
|
|---|
| 22 | require_once('portlets/PortletsClass.php');
|
|---|
| 23 | $oDb = &newDb( 'wiki',true );
|
|---|
| 24 | $bDb = &newDb( 'blogs',true);
|
|---|
| 25 | $mDb = &newDb( 'bookmarks',true );
|
|---|
| 26 | $fDb = &newDb( 'forum',true );
|
|---|
| 27 | $ContributorPortlet = new ContributorPortlet($oDb,$bDb,$mDb,$fDb);
|
|---|
| 28 | $SkillPortlet = new SkillPortlet($oDb,$bDb,$mDb,$fDb);
|
|---|
| 29 | $CommunityChartPortlet = new CommunityChartPortlet($oDb);
|
|---|
| 30 | $ActivityPortlet = new ActivityPortlet($oDb,$bDb,$mDb,$fDb);
|
|---|
| 31 | $ArticlePortlet = new ArticlePortlet($oDb);
|
|---|
| 32 | $TeamContributionStatistics = new TeamContributionStatistics($oDb);
|
|---|
| 33 | /********* generate top 5 contributio team ******/
|
|---|
| 34 | saveCache(TeamContribution,$TeamContributionStatistics->_GetTop5ContributionThisMonth_v2());
|
|---|
| 35 |
|
|---|
| 36 | /********* cache featured article **********/
|
|---|
| 37 | saveCache(ArticlePortlet,$ArticlePortlet->getPortlet());
|
|---|
| 38 | saveCache(LatestArticlePortlet, $ArticlePortlet->getNewPostedArticlePortlet(3));
|
|---|
| 39 |
|
|---|
| 40 | /********* **********/
|
|---|
| 41 | saveCache(Notes,$ContributorPortlet->loadNotes());
|
|---|
| 42 |
|
|---|
| 43 | //community skills ->community skills
|
|---|
| 44 | saveCache(SkillChart,$SkillPortlet->loadSkillChart(null));
|
|---|
| 45 | saveCache(SkillPortlet, $SkillPortlet->loadSkillPortlet());
|
|---|
| 46 | //community chart -> article usage
|
|---|
| 47 | saveCache(UserUsage, $CommunityChartPortlet->loadUserUsage('incremental',true));
|
|---|
| 48 | //community chart -> article score
|
|---|
| 49 | saveCache(UserScores, $CommunityChartPortlet->loadUserScores());
|
|---|
| 50 | //recent activity -> site activity\
|
|---|
| 51 | saveCache(SiteActivity, $ActivityPortlet->loadSiteActivity(7));
|
|---|
| 52 |
|
|---|
| 53 | saveCache(Information, $ContributorPortlet->loadInformation());
|
|---|
| 54 | saveCache(ContributorActivity, $ContributorPortlet->loadActivity(10));
|
|---|
| 55 | saveCache(ContributorUserScores, $ContributorPortlet->loadUserScores());
|
|---|
| 56 | saveCache(SkillsSkill, $ContributorPortlet->loadSkills('skill'));
|
|---|
| 57 | saveCache(SkillsRole, $ContributorPortlet->loadSkills('role'));
|
|---|
| 58 | saveCache(FeaturedContributor, $ContributorPortlet->loadFeaturedContributor()); // New Featured Contributor Portlet
|
|---|
| 59 | saveCache(TopContributors, $ContributorPortlet->getTopContributors()); // Top Contributors Portlet
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 | /************** ***************/
|
|---|
| 63 | $ContributionStatistics = new ContributionStatistics('', false);
|
|---|
| 64 | $ContributionStatistics -> setExistingDBConnection($oDb,$bDb,$mDb,$fDb);
|
|---|
| 65 | saveCache(Top10ContributorThisMonth,$ContributionStatistics->_GetTop10ContributionThisMonth());
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | $contributorThisWeek = $ContributorPortlet->getUserName();
|
|---|
| 69 | saveCache(ContributionMonthlyLastYear,
|
|---|
| 70 | file_get_contents('http://'.$_SERVER['HTTP_HOST'].
|
|---|
| 71 | RR_OMCOLLAB_DIRECTORY.'home/contribution/IndividualContributionWidget.php?userName='.
|
|---|
| 72 | $contributorThisWeek.'&displayFor=contributorThisWeek'));
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | saveCache(MembersPage,loadWikiMainPage("Members",10000));
|
|---|
| 76 | saveCache(ShortcutsPage,loadWikiMainPage("Shortcuts",10000));
|
|---|
| 77 | saveCache(WelcomePage,loadWikiMainPage("Welcome",10000));
|
|---|
| 78 |
|
|---|
| 79 | function saveCache($cacheName,$content,$type='wb'){
|
|---|
| 80 | $cachePath='./omcache/';
|
|---|
| 81 | if(!@is_dir($cachePath)){
|
|---|
| 82 | if(!@mkdir($cache_dirname,0777)){
|
|---|
| 83 | return;
|
|---|
| 84 | }
|
|---|
| 85 | }
|
|---|
| 86 | if (!$handle = fopen($cachePath.$cacheName.'.html', $type)) {
|
|---|
| 87 | return;
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | if (fwrite($handle, $content) === FALSE) {
|
|---|
| 91 | return;
|
|---|
| 92 | }
|
|---|
| 93 | fclose($handle);
|
|---|
| 94 | }
|
|---|
| 95 | ?>
|
|---|