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); }
protected function importSystemCaptchaLibraries(SimpleXMLElement $sx) { if (isset($sx->systemcaptcha)) { Loader::model('system/captcha/library'); foreach($sx->systemcaptcha->library as $th) { $pkg = ContentImporter::getPackageObject($th['package']); $scl = SystemCaptchaLibrary::add($th['handle'], $th['name'], $pkg); if ($th['activated'] == '1') { $scl->activate(); } } } }