public function run() { $db = Loader::db(); $columns = $db->MetaColumns('Pages'); if (!isset($columns['CISSYSTEMPAGE'])) { $db->Execute('alter table Pages add column cIsSystemPage tinyint(1) not null default 0'); $db->Execute('alter table Pages add index (cIsSystemPage)'); } $columns = $db->MetaColumns('Pages'); if (!isset($columns['CISACTIVE'])) { $db->Execute('alter table Pages add column cIsActive tinyint(1) not null default 1'); $db->Execute('alter table Pages add index (cIsActive)'); $db->Execute('update Pages set cIsActive = 1'); } $columns = $db->MetaColumns('PageSearchIndex'); if (!isset($columns['CREQUIRESREINDEX'])) { $db->Execute('alter table PageSearchIndex add column cRequiresReindex tinyint(1) not null default 0'); $db->Execute('alter table PageSearchIndex add index (cRequiresReindex)'); } // install version job Loader::model("job"); Job::installByHandle('remove_old_page_versions'); // flag system pages appropriately Page::rescanSystemPages(); // add a newsflow task permission $db = Loader::db(); $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('view_newsflow')); if ($cnt < 1) { $g3 = Group::getByID(ADMIN_GROUP_ID); $tip = TaskPermission::addTask('view_newsflow', t('View Newsflow'), false); if (is_object($g3)) { $tip->addAccess($g3); } } // Install new block types $this->installBlockTypes(); // install stacks, trash and drafts $this->installSinglePages(); // move the old dashboard $newDashPage = Page::getByPath('/dashboard/welcome'); if (!is_object($newDashPage) || $newDashPage->isError()) { $dashboard = Page::getByPath('/dashboard'); $dashboard->moveToTrash(); // install new dashboard + page types $this->installDashboard(); $this->migrateOldDashboard(); } Loader::model('system/captcha/library'); $scl = SystemCaptchaLibrary::getByHandle('securimage'); if (!is_object($scl)) { $scl = SystemCaptchaLibrary::add('securimage', t('SecurImage (Default)')); $scl->activate(); } Config::save('SEEN_INTRODUCTION', 1); }
function install($handle = null) { if ($handle) { Loader::model("job"); Job::installByHandle($handle); $this->redirect('/dashboard/system/optimization/jobs', 'job_installed'); } else { $this->error->add(t('No job specified.')); } $this->view(); }
function install($handle = null) { if ($handle) { Loader::model("job"); Job::installByHandle($handle); $this->set('message', t('Job succesfully installed.')); } else { $this->error->add(t('No job specified.')); } $this->view(); }
public function run() { // contains all the items that have changed from 5.0.0a1 to the next version $db = Loader::db(); // create jobs dashboard page Loader::model("job"); Loader::model('single_page'); Job::installByHandle('index_search'); $d11 = SinglePage::add('/dashboard/jobs'); if (is_object($d11)) { $d11->update(array('cName'=>t('Maintenance'), 'cDescription'=>t('Run common cleanup tasks.'))); } }
public function run() { Loader::model("job"); Loader::model('single_page'); Job::installByHandle('generate_sitemap'); $d1 = SinglePage::add('/download_file'); if (is_object($d1)) { $d1->update(array('cName'=>'Download File')); } $d2 = SinglePage::add('/dashboard/logs'); if (is_object($d2)) { $d2->update(array('cName'=>'Logging', 'cDescription' => 'Keep tabs on your site.')); } }
public function run() { $j = Job::getByHandle('index_search_all'); if (!is_object($j)) { Job::installByHandle('index_search_all'); } $js = JobSet::getByName('Default'); if (!is_object($js)) { $js = JobSet::add('Default'); } $js->clearJobs(); $jobs = Job::getList(); foreach($jobs as $j) { if (!$j->supportsQueue()) { $js->addJob($j); } } // create the view page in sitemap permission $rpk = PermissionKey::getByHandle('view_page'); $vpk = PermissionKey::getByHandle('view_page_in_sitemap'); if (!is_object($vpk)) { $vpk = PermissionKey::add('page', 'view_page_in_sitemap', 'View Page in Sitemap', 'View Page in Sitemap and Intelligent Search.', false, false); } // now we have to get a list of all pages in the site that have their own permissions set. $db = Loader::db(); $r = $db->Execute('select cID from Pages where cInheritPermissionsFrom = "OVERRIDE" order by cID asc'); while ($row = $r->Fetchrow()) { $c = Page::getByID($row['cID']); if (is_object($c) && !$c->isError()) { $rpk->setPermissionObject($c); $vpk->setPermissionObject($c); $rpa = $rpk->getPermissionAccessObject(); if (is_object($rpa)) { $pt = $vpk->getPermissionAssignmentObject(); if (is_object($pt)) { $pt->clearPermissionAssignment(); $pt->assignPermissionAccess($rpa); } } } } }
protected function updateJobs() { $this->output(t('Updating jobs...')); if (!($job = \Job::getByHandle('update_statistics'))) { \Job::installByHandle('update_statistics'); } }
public function run() { $db = Loader::db(); Cache::disableLocalCache(); Loader::model('attribute/categories/collection'); Loader::model('attribute/categories/file'); Loader::model('attribute/categories/user'); $collectionErrors = array(); $fileErrors = array(); $userErrors = array(); //add the new collection attribute keys $this->installCoreAttributeItems(); $dict = NewDataDictionary($db->db, DB_TYPE); $tables = $db->MetaTables(); if (in_array('_CollectionAttributeKeys', $tables)) { $collectionErrors = $this->upgradeCollectionAttributes(); } if (in_array('_FileAttributeKeys', $tables)) { $fileErrors = $this->upgradeFileAttributes(); } if (in_array('_UserAttributeKeys', $tables)) { $userErrors = $this->upgradeUserAttributes(); } $cak=CollectionAttributeKey::getByHandle('exclude_sitemapxml'); if (!is_object($cak)) { $cak = CollectionAttributeKey::add('exclude_sitemapxml', t('Exclude From sitemap.xml'), true, null, 'BOOLEAN'); } //change the page/tab name of the dashboard users registration page $dashboardRegistrationPage=Page::getByPath('/dashboard/users/registration'); if( intval($dashboardRegistrationPage->cID) ) $dashboardRegistrationPage->update(array('cName'=>t('Login & Registration'))); Config::save('LOGIN_ADMIN_TO_DASHBOARD', 1); //profile friends page install Loader::model('single_page'); $friendsPage=Page::getByPath('/profile/friends'); if( !intval($friendsPage->cID)) { SinglePage::add('/profile/friends'); } $membersPage =Page::getByPath('/members'); if( !intval($membersPage->cID)) { SinglePage::add('/members'); } $messagesPage =Page::getByPath('/profile/messages'); if( !intval($messagesPage->cID)) { SinglePage::add('/profile/messages'); } $ppme = UserAttributeKey::getByHandle('profile_private_messages_enabled'); if (!is_object($ppme)) { UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_enabled', 'akName' => t('I would like to receive private messages.'), 'akIsSearchable' => true)); } $ppmne = UserAttributeKey::getByHandle('profile_private_messages_notification_enabled'); if (!is_object($ppmne)) { UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_notification_enabled', 'akName' => t('Send me email notifications when I receive a private message.'), 'akIsSearchable' => true)); } $em = Page::getByPath('/dashboard/settings'); if (!$em->isError()) { $em = SinglePage::getByID($em->getCollectionID()); $em->refresh(); } $em1=Page::getByPath('/dashboard/settings/mail'); if ($em1->isError()) { $em1 = SinglePage::add('/dashboard/settings/mail'); $em1->update(array('cName'=>t('Email'), 'cDescription'=>t('Enable post via email and other settings.'))); } // remove adodb database logs $databaseReports = Page::getByPath('/dashboard/reports/database'); if (!$databaseReports->isError()) { $databaseReports->delete(); } if (in_array('adodb_logsql', $tables)) { @$db->query('DROP TABLE adodb_logsql'); } Loader::library('mail/importer'); $mi = MailImporter::getByHandle("private_message"); if (!is_object($mi)) { MailImporter::add(array('miHandle' => 'private_message')); } Loader::model("job"); Job::installByHandle('process_email'); Cache::enableLocalCache(); return array_merge($collectionErrors, $fileErrors, $userErrors); }
} echo 'Done<br/>'; flush(); ob_flush(); } // install jobs echo '<br/>'; echo 'Installing jobs... <br/>'; $jobs = array('stat_user_activities'); foreach ($jobs as $j) { $jb = Job::getByHandle($j); if (is_object($jb)) { echo "Job {$j} had been installed; skip intalling. <br/>"; } else { #Job::installByPackage($j, $pkg); Job::installByHandle($j); echo "Job {$j} newly installed. <br/>"; } flush(); ob_flush(); } // Apply full_stack_style as the site theme echo '<br/>'; echo 'Applying full_stack_style as site theme...'; $pt = PageTheme::getByHandle('full_stack_style'); $pt->applyToSite(); echo 'Done.<br/>'; // Install event extends here #Events::extend('on_start', 'FSENLocalization', 'setupInterfaceLocalization4Request', 'models/fsen_localization.php'); #Events::extend('on_before_render', 'FSENLocalization', 'setupInterfaceLocalization4Page', 'models/fsen_localization.php'); // Apply page type for HOME page
protected function importJobs(SimpleXMLElement $sx) { Loader::model('job'); if (isset($sx->jobs)) { foreach($sx->jobs->job as $jx) { $pkg = ContentImporter::getPackageObject($jx['package']); if (is_object($pkg)) { Job::installByPackage($jx['handle'], $pkg); } else { Job::installByHandle($jx['handle']); } } } }
function install() { $jobObj = Loader::model("job"); Job::installByHandle($_POST['jHandle']); $this->redirect('/dashboard/system/jobs'); }