Author: Yorick Peterse
Author: PyroCMS Dev Team
Inheritance: extends CI_Controller
Ejemplo n.º 1
0
    /**
     * Create the config file with the database settings and write email settings
     *
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeSaveData(sfWebRequest $request) {
        $sysObj = new SystemSetting();
        $installer = new Installer();
        $data = $request->getPostParameters();
        $installer->createConfigFile($data); // write settings in database.yml
        // create DB
        $task = new sfDoctrineBuildAllReLoadTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
        chdir(sfConfig::get('sf_root_dir'));
        $task->run(array(),array('--no-confirmation', '--env=all', '--dir='.sfConfig::get('sf_root_dir').'/data/fixtures/'.$data['productive_data'].''));
        $data = $sysObj->buildEmailSetting($data);
        UserLoginTable::instance()->updateEmail($data['productive_emailadresse']);
        EmailConfigurationTable::instance()->updateEmailConfiguration($data);
        // clear cache
        $taskCC = new sfCacheClearTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
        $taskCC->run(array(), array());
        // create JS Cache
        $ccCache = new TemplateCaching();
        $ccCache->checkCacheDir();
        $ccCache->setFiles();
        $lastModified = $ccCache->getLastModifiedFile();
        $cacheCreated = $ccCache->getCurrentCacheStamp();

        if($lastModified > $cacheCreated OR $cacheCreated == '') {
            if($cacheCreated == '') {
                $cacheCreated = $lastModified;
            }
            $ccCache->createCache($lastModified, $cacheCreated);
        }
        // return success, then JS redirect
        $this->renderText('{success:true}');
        return sfView::NONE;
    }
Ejemplo n.º 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $autoRegister = $input->getOption('auto-register');
     $installer = new \Installer();
     $installed = $installer->tableExists('users_users');
     if ($installed) {
         $installer->update();
         $output->writeln('Update completed.');
         if (count($installer->installed)) {
             foreach ($installer->installed as $patch) {
                 $output->writeln("<info>Installed: {$patch}</info>");
             }
         }
         if (count($installer->executed)) {
             foreach ($installer->executed as $script) {
                 $output->writeln("<info>Executed: {$script}</info>");
             }
         }
         $output->writeln('<info>Queries executed successfully: ' . count($installer->success) . '</info>');
         if (count($installer->failures)) {
             foreach ($installer->failures as $key => $error) {
                 list($query, $message, $patch) = $error;
                 $output->writeln("<error>Error {$key} in {$patch}\n\t{$query}\n\t{$message}</error>");
                 if ($autoRegister) {
                     $installer->recordPatch($patch);
                 }
             }
         }
         $cachelib = \TikiLib::lib('cache');
         $cachelib->empty_cache();
     } else {
         $output->writeln('<error>Database not found.</error>');
     }
 }
Ejemplo n.º 3
0
 public function testPasswordIsInvalid()
 {
     $post_variables = $this->post_variables;
     $post_variables['pass'] = '';
     $installer = new Installer($post_variables, $this->manualPath);
     $this->assertEquals(FALSE, $installer->password_is_valid());
 }
 public function testExecute()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(true));
     $this->installer->expects($this->once())->method('installUserConfig');
     $this->installerFactory->expects($this->once())->method('create')->will($this->returnValue($this->installer));
     $tester = new CommandTester($this->command);
     $tester->execute([]);
 }
Ejemplo n.º 5
0
 public function testAvailableProfilesConformToSchema()
 {
     $va_profiles = caGetAvailableXMLProfiles(dirname(__FILE__) . '/../../install/');
     $this->assertGreaterThan(0, sizeof($va_profiles));
     foreach ($va_profiles as $vs_profile) {
         $vo_installer = new Installer(dirname(__FILE__) . '/../../install/profiles/xml/', $vs_profile, '*****@*****.**', false, false);
         $this->assertEquals(0, $vo_installer->numErrors(), "The profile '{$vs_profile}' doesn't conform to the XML schema");
     }
 }
Ejemplo n.º 6
0
 /**
  * uninstall the module
  *
  * @since 2.6.0
  */
 public function uninstall()
 {
     if (array_key_exists('alias', static::$_moduleArray)) {
         Db::forTablePrefix('modules')->where('alias', static::$_moduleArray['alias'])->deleteMany();
         /* drop from sql */
         $directory = 'modules/' . static::$_moduleArray['alias'] . '/database';
         if (is_dir($directory)) {
             $installer = new Installer(Config::getInstance());
             $installer->init($directory);
             $installer->rawDrop();
         }
     }
 }
Ejemplo n.º 7
0
 public function downloadLanguage($data)
 {
     $code = $data['lang_code'];
     if ($code == 'en-GB') {
         $this->session->data['lang_name'] = 'English';
         $this->session->data['lang_code'] = 'en';
         $this->session->data['lang_image'] = 'gb.png';
         $this->session->data['lang_directory'] = 'en-GB';
         // Workaround to mutual session ids
         $this->session->data['config_language'] = 'en';
         $this->session->data['config_admin_language'] = 'en';
         return $code;
     }
     $link = 'https://crowdin.com/download/project/arastta/' . $code . '.zip';
     $data = $this->utility->getRemoteData($link);
     if (empty($data)) {
         return false;
     }
     $path = 'temp-' . md5(mt_rand());
     $file = DIR_UPLOAD . $path . '/upload.zip';
     if (!is_dir(DIR_UPLOAD . $path)) {
         $this->filesystem->mkdir(DIR_UPLOAD . $path);
     }
     $uploaded = is_int(file_put_contents($file, $data)) ? true : false;
     if (!$uploaded) {
         return false;
     }
     $installer = new Installer($this->registry);
     if (!$installer->unzip($file)) {
         return false;
     }
     // Remove Zip
     $this->filesystem->remove($file);
     $temp_path = DIR_UPLOAD . $path;
     $json = json_decode(file_get_contents($temp_path . '/install.json'), true);
     $this->session->data['lang_name'] = $json['translation']['name'];
     $this->session->data['lang_code'] = $json['translation']['code'];
     $this->session->data['lang_image'] = $json['translation']['image'];
     $this->session->data['lang_directory'] = $json['translation']['directory'];
     // Workaround to mutual session ids
     $this->session->data['config_language'] = $json['translation']['code'];
     $this->session->data['config_admin_language'] = $json['translation']['code'];
     $lang_dir = $json['translation']['directory'];
     // Move all files/folders from temp path
     $this->filesystem->mirror($temp_path . '/admin', DIR_ADMIN . 'language/' . $lang_dir, null, array('override' => true));
     $this->filesystem->mirror($temp_path . '/catalog', DIR_CATALOG . 'language/' . $lang_dir, null, array('override' => true));
     $this->filesystem->mirror($temp_path . '/install', DIR_INSTALL . 'language/' . $lang_dir, null, array('override' => true));
     // Delete the temp path
     $this->filesystem->remove($temp_path);
     return $lang_dir;
 }
Ejemplo n.º 8
0
 public function update()
 {
     $version = $this->request->get['version'];
     $product_id = $this->request->get['product_id'];
     $data = $this->update->downloadUpdate($product_id, $version);
     $path = 'temp-' . md5(mt_rand());
     $file = DIR_UPLOAD . $path . '/upload.zip';
     if (!is_dir(DIR_UPLOAD . $path)) {
         $this->filesystem->mkdir(DIR_UPLOAD . $path);
     }
     $uploaded = is_int(file_put_contents($file, $data)) ? true : false;
     if (!$uploaded) {
         return false;
     }
     // Fire event
     $this->trigger->fire('pre.admin.update.update', $product_id);
     // Force enable maintenance mode
     $maintenance_mode = $this->config->get('maintenance_mode');
     $this->config->set('maintenance_mode', 1);
     $installer = new Installer($this->registry);
     if (!$installer->unzip($file)) {
         return false;
     }
     // Remove Zip
     $this->filesystem->remove($file);
     if ($product_id == 'core') {
         $temp_path = DIR_UPLOAD . $path;
         $install_path = $temp_path . '/install';
         // Load the update script, if available
         if (is_file($install_path . '/update.php')) {
             require_once $install_path . '/update.php';
         }
         // Don't copy the install folder
         $this->filesystem->remove($install_path);
         // Move all files/folders from temp path
         $this->filesystem->mirror($temp_path, DIR_ROOT, null, array('override' => true));
         // Delete the temp path
         $this->filesystem->remove($temp_path);
     } else {
         // Required for ftp & remove extension functions
         $this->request->post['path'] = $path;
         $ftp = $this->load->controller('extension/installer/ftp');
         $remove = $this->load->controller('extension/installer/remove');
         $this->db->query("UPDATE `" . DB_PREFIX . "addon` SET `product_version` = '" . $this->db->escape($version) . "' WHERE `product_id` = '" . (int) $product_id . "'");
     }
     // Restore maintenance mode
     $this->config->set('maintenance_mode', $maintenance_mode);
     // Fire event
     $this->trigger->fire('post.admin.update.update', $product_id);
     return true;
 }
Ejemplo n.º 9
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //Installers
     // $installers = Installer::orderBy('business_name','ASC')->get()->toArray();
     $installers = array('' => 'Select an Installer') + Installer::orderBy('business_name', 'ASC')->lists('business_name', 'id');
     return View::make('register.create')->with('installers', $installers);
 }
Ejemplo n.º 10
0
	/**
	 * Return the full text of the generated LocalSettings.php file,
	 * including the extensions
	 *
	 * @return String
	 */
	public function getText() {
		$localSettings = $this->getDefaultText();

		if ( count( $this->extensions ) ) {
			$extensions = $this->installer->findExtensions();
			$localSettings .= "
# Enabled Extensions. Most extensions are enabled by including the base extension file here
# but check specific extension documentation for more details
# The following extensions were automatically enabled:\n";

			$ip = $this->installer->getVar( 'IP' );
			foreach ( $this->extensions as $ext) {
				$path = str_replace( $ip, '', $extensions[$ext]['path'] );
				$prefix = '';
				if ( $path !== $extensions[$ext]['path'] ) {
					$prefix = '$IP';
				}
				$path = $prefix . self::escapePhpString( $path );
				$localSettings .= "require_once \"$path\";\n";
			}
		}

		$localSettings .= "\n\n# End of automatically generated settings.
# Add more configuration options below.\n\n";

		return $localSettings;
	}
Ejemplo n.º 11
0
 function getHTML($smarty)
 {
     $smarty->assign_by_ref('field', $this);
     $output = $smarty->fetch(Installer::getTemplatePath("field_{$this->type}.tpl"));
     $smarty->clear_assign('field');
     return $output;
 }
Ejemplo n.º 12
0
 public function __construct($VariablesArray)
 {
     Installer::$DBConnection = $VariablesArray[0]::$Connection;
     Installer::$CConnection = $VariablesArray[0]::$CConnection;
     Installer::$WConnection = $VariablesArray[0]::$WConnection;
     Installer::$TM = $VariablesArray[1];
 }
Ejemplo n.º 13
0
 /**
  * @param $dir
  * @param $create bool
  * @return Status
  */
 private static function dataDirOKmaybeCreate($dir, $create = false)
 {
     if (!is_dir($dir)) {
         if (!is_writable(dirname($dir))) {
             $webserverGroup = Installer::maybeGetWebserverPrimaryGroup();
             if ($webserverGroup !== null) {
                 return Status::newFatal('config-sqlite-parent-unwritable-group', $dir, dirname($dir), basename($dir), $webserverGroup);
             } else {
                 return Status::newFatal('config-sqlite-parent-unwritable-nogroup', $dir, dirname($dir), basename($dir));
             }
         }
         # Called early on in the installer, later we just want to sanity check
         # if it's still writable
         if ($create) {
             wfSuppressWarnings();
             $ok = wfMkdirParents($dir, 0700);
             wfRestoreWarnings();
             if (!$ok) {
                 return Status::newFatal('config-sqlite-mkdir-error', $dir);
             }
             # Put a .htaccess file in in case the user didn't take our advice
             file_put_contents("{$dir}/.htaccess", "Deny from all\n");
         }
     }
     if (!is_writable($dir)) {
         return Status::newFatal('config-sqlite-dir-unwritable', $dir);
     }
     # We haven't blown up yet, fall through
     return Status::newGood();
 }
Ejemplo n.º 14
0
 public static function run($folder = '.')
 {
     global $FAQ, $CONFIG;
     self::$folder = $folder;
     self::$software = $CONFIG['SOFTWARE'];
     self::$package = $CONFIG['PACKAGE_NAME'];
     self::$packageUrl = $CONFIG['PACKAGE_URL'];
     self::$me = basename(__FILE__);
     $step = 1;
     if (isset($_REQUEST['step']) && is_numeric($_REQUEST['step']) && isset($_REQUEST['proceed'])) {
         $step = $_REQUEST['step'];
     }
     ob_start();
     switch (Installer::testDirAccess()) {
         case 0:
             self::printError($FAQ['NO_FILESYSTEM_ACCESS']);
             exit;
             break;
         case 2:
             echo "Limited Access";
             exit;
             break;
     }
     if (!self::testZipCapability()) {
         self::printError($FAQ['NO_ZIP_SUPPORT']);
         exit;
     }
     $download = !file_exists(self::$package);
     if ($download) {
         $handle = @fopen(self::$packageUrl, "rb");
         if (!$handle) {
             self::printError($FAQ['DOWNLOAD_RESTRICTIONS']);
             exit;
         } else {
             fclose($handle);
         }
     }
     switch ($step) {
         case 1:
             self::printForm();
             break;
         case 2:
             self::installPackage($download);
             if (isset($CONFIG['PROTECT'])) {
                 self::printProtect();
             } else {
                 self::printSuccess();
             }
             break;
         case 3:
             self::protect();
             self::printSuccess();
             break;
         case 4:
             self::remove();
             header('Location: ' . $CONFIG['AFTER_INSTALL']);
             break;
     }
     ob_end_flush();
 }
Ejemplo n.º 15
0
 /**
  * This function returns an instance of the Installer
  * class. It is the only way to create a new Installer, as
  * it implements the Singleton interface
  *
  * @return Installer
  */
 public static function instance()
 {
     if (!self::$_instance instanceof Installer) {
         self::$_instance = new Installer();
     }
     return self::$_instance;
 }
Ejemplo n.º 16
0
 /**
  * Pre-installation.
  * @return boolean
  */
 function preInstall()
 {
     $this->currentVersion = Version::fromString('');
     $this->locale = $this->getParam('locale');
     $this->installedLocales = $this->getParam('additionalLocales');
     if (!isset($this->installedLocales) || !is_array($this->installedLocales)) {
         $this->installedLocales = array();
     }
     if (!in_array($this->locale, $this->installedLocales) && Locale::isLocaleValid($this->locale)) {
         array_push($this->installedLocales, $this->locale);
     }
     if ($this->getParam('manualInstall')) {
         // Do not perform database installation for manual install
         // Create connection object with the appropriate database driver for adodb-xmlschema
         $conn =& new DBConnection($this->getParam('databaseDriver'), null, null, null, null);
         $this->dbconn =& $conn->getDBConn();
     } else {
         // Connect to database
         $conn =& new DBConnection($this->getParam('databaseDriver'), $this->getParam('databaseHost'), $this->getParam('databaseUsername'), $this->getParam('databasePassword'), $this->getParam('createDatabase') ? null : $this->getParam('databaseName'), true, $this->getParam('connectionCharset') == '' ? false : $this->getParam('connectionCharset'));
         $this->dbconn =& $conn->getDBConn();
         if (!$conn->isConnected()) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
     }
     DBConnection::getInstance($conn);
     return parent::preInstall();
 }
Ejemplo n.º 17
0
 /**
  *  Handles LiveCart update process
  */
 public function update()
 {
     $dir = ClassLoader::getRealPath('update') . '/' . $this->getCurrentVersion();
     if (!is_dir($dir)) {
         return new RawResponse('Update directory not found');
     }
     $progress = array();
     $errors = array();
     // load SQL dump file
     $sql = $dir . '/update.sql';
     if (file_exists($sql)) {
         try {
             Installer::loadDatabaseDump(file_get_contents($sql), true, $this->request->get('force'));
             $progress['sql'] = true;
         } catch (Exception $e) {
             $errors['sql'] = $e->getMessage();
         }
     }
     $this->application->getConfigContainer()->clearCache();
     // execute custom update code
     $code = $dir . '/custom.php';
     if (file_exists($code)) {
         ob_start();
         if (!(include $code)) {
             $errors['code'] = ob_get_contents();
         } else {
             $progress['code'] = true;
         }
         ob_end_clean();
     }
     $response = new ActionResponse();
     $response->set('progress', $progress);
     $response->set('errors', $errors);
     return $response;
 }
Ejemplo n.º 18
0
 /**
  * 
  * @throws Installer_Exception
  */
 public function action_go()
 {
     $this->auto_render = FALSE;
     $post = $this->request->post('install');
     try {
         $this->_installer->install($post);
         Observer::notify('after_install', $post);
         Cache::clear_file();
     } catch (Validation_Exception $e) {
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (Exception $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     $this->go($post['admin_dir_name'] . '/login');
 }
Ejemplo n.º 19
0
 /**
  * Main entry point.
  */
 public function execute()
 {
     $vars = Installer::getExistingLocalSettings();
     if ($vars) {
         $this->showStatusMessage(Status::newFatal("config-localsettings-cli-upgrade"));
     }
     $this->performInstallation(array($this, 'startStage'), array($this, 'endStage'));
 }
Ejemplo n.º 20
0
 public function testingNW($params)
 {
     if (isset($_POST['NW_TITLE'])) {
         $action = isset($_POST['action']) ? trim($_POST['action']) : 'test';
         $ao_db_drop = isset($_POST['AO_DB_DROP']) ? true : false;
         G::LoadClass('Installer');
         //G::LoadClass( 'json' );
         $name = trim($_POST['NW_TITLE']);
         $inst = new Installer();
         if ($inst->isset_site($name) && $ao_db_drop !== true) {
             $this->error = true;
             return;
         }
         $user = isset($_POST['NW_USERNAME']) ? trim($_POST['NW_USERNAME']) : 'admin';
         $pass = isset($_POST['NW_PASSWORD']) ? $_POST['NW_PASSWORD'] : '******';
         $pass1 = isset($_POST['NW_PASSWORD2']) ? $_POST['NW_PASSWORD2'] : 'admin';
         $ao_db_wf = isset($_POST['AO_DB_WF']) ? $_POST['AO_DB_WF'] : false;
         $ao_db_rb = isset($_POST['AO_DB_RB']) ? $_POST['AO_DB_RB'] : false;
         $ao_db_rp = isset($_POST['AO_DB_RP']) ? $_POST['AO_DB_RP'] : false;
         $result = $inst->create_site(array('isset' => true, 'name' => $name, 'admin' => array('username' => $user, 'password' => $pass), 'advanced' => array('ao_db_drop' => $ao_db_drop, 'ao_db_wf' => $ao_db_wf, 'ao_db_rb' => $ao_db_rb, 'ao_db_rp' => $ao_db_rp)), $action === 'create' ? true : false);
         $result['result']['admin']['password'] = $pass === $pass1 ? true : false;
         $result['result']['action'] = $action;
         $_SESSION['NW_PASSWORD'] = $pass;
         $_SESSION['NW_PASSWORD2'] = $pass1;
         //$json = new Services_JSON();
         //G::pr($result['result']['database']);G::pr($action);
         $dbWf = $result['result']['database']['ao']['ao_db_wf']['status'];
         $dbRb = $result['result']['database']['ao']['ao_db_rb']['status'];
         $dbRp = $result['result']['database']['ao']['ao_db_rp']['status'];
         $wsAction = $action != '' ? 1 : 0;
         if ($dbWf && $action) {
             $this->success = true;
             //echo $json->encode($result);
         } else {
             //the site does not available
             $this->error = true;
             $this->message = $result['result']['database']['ao']['ao_db_wf']['message'];
             //$this->message .= ', ' . $result['result']['database']['ao']['ao_db_rb']['message'];
             //$this->message .= ', ' . $result['result']['database']['ao']['ao_db_rp']['message'];
         }
     } else {
         $this->error = true;
     }
 }
Ejemplo n.º 21
0
 protected function _execute(array $params)
 {
     if ($params['db_driver'] === NULL) {
         $params['db_driver'] = Minion_CLI::read(__('Please enter database driver (:types)', array(':types' => implode(', ', array_keys($this->_installer->database_drivers())))));
     }
     if ($params['locale'] === NULL) {
         $params['locale'] = Minion_CLI::read(__('Please enter locale (:types)', array(':types' => implode(', ', array_keys(I18n::available_langs())))));
     }
     if ($params['db_name'] === NULL) {
         $params['db_name'] = Minion_CLI::read(__('Please enter database name'));
     }
     if ($params['timezone'] === NULL) {
         $answer = Minion_CLI::read(__('Select current timezone automaticly (:current)', array(':current' => date_default_timezone_get())), array('y', 'n'));
         if ($answer == 'y') {
             $params['timezone'] = date_default_timezone_get();
         } else {
             $params['timezone'] = Minion_CLI::read(__('Please enter current timezone (:site)', array(':site' => 'http://www.php.net/manual/en/timezones.php')), DateTimeZone::listIdentifiers());
         }
     }
     if ($params['cache_type'] === NULL) {
         $params['cache_type'] = Minion_CLI::read(__('Please enter cache type (:types)', array(':types' => implode(', ', array_keys($this->_installer->cache_types())))));
     }
     if ($params['session_type'] === NULL) {
         $session_types = Kohana::$config->load('installer')->get('session_types', array());
         $params['session_type'] = Minion_CLI::read(__('Please enter session type (:types)', array(':types' => implode(', ', array_keys($this->_installer->session_types())))));
     }
     if ($params['password'] !== NULL) {
         unset($params['password_generate']);
         $params['password_field'] = $params['password_confirm'] = $params['password'];
     }
     try {
         $this->_installer->install($params);
         Observer::notify('after_install', $params);
         Cache::clear_file();
         Minion_CLI::write('==============================================');
         Minion_CLI::write(__('KodiCMS installed successfully'));
         Minion_CLI::write('==============================================');
         $install_data = Session::instance()->get_once('install_data');
         Minion_CLI::write(__('Login: :login', array(':login' => Arr::get($install_data, 'username'))));
         Minion_CLI::write(__('Password: :password', array(':password' => Arr::get($install_data, 'password_field'))));
     } catch (Exception $e) {
         Minion_CLI::write(__(':text | :file [:line]', array(':text' => $e->getMessage(), ':file' => $e->getFile(), ':line' => $e->getLine())));
     }
 }
Ejemplo n.º 22
0
 function getHTML($smarty)
 {
     $file_contents = 'Could not read file ' . $this->file_name;
     if (is_readable($this->file_name)) {
         $file_contents = file($this->file_name);
         $file_contents = join('', $file_contents);
     }
     $smarty->assign('FILE_CONTENTS', $file_contents);
     return $smarty->fetch(Installer::getTemplatePath('action_accept_text.tpl'));
 }
Ejemplo n.º 23
0
 /**
  * Skip the test if 'gzip' is not in $PATH.
  *
  * @return bool
  */
 protected function checkHasGzip()
 {
     if (self::$hasGzip === null) {
         self::$hasGzip = Installer::locateExecutableInDefaultPaths('gzip') !== false;
     }
     if (!self::$hasGzip) {
         $this->markTestSkipped("Skip test, requires the gzip utility in PATH");
     }
     return self::$hasGzip;
 }
 public static function add()
 {
     parent::add();
     self::$facebook_app_id = Installer::getComposerEvent()->getIO()->ask(":: enter your facebook app id: ", "[app_id]");
     self::$facebook_api_secret = Installer::getComposerEvent()->getIO()->ask(":: enter your facebook app secret: ", "[app_secret]");
     File::replaceContent(Installer::getRootDirConfig() . self::getConfigfile(), "[app_id]", self::getFacebookAppId());
     File::replaceContent(Installer::getRootDirConfig() . self::getConfigfile(), "[api_secret]", self::getFacebookApiSecret());
     File::addContent(Installer::getRootDirTheme() . "Includes/Footer.ss", "<% include FacebookLoginLink %>", "SilverStripe</a></small>");
     Installer::getComposerEvent()->getIO()->write(":: added facebookconnect extension");
 }
Ejemplo n.º 25
0
 /**
  * Verifies the site meets any requirements specified by the app or theme.
  */
 public static function verify_requires($requires)
 {
     if (isset($requires->php) && version_compare(PHP_VERSION, $requires->php) < 0) {
         self::$error = i18n_getf('Verification failed: This install requires PHP %s or newer.', $requires->php);
         return false;
     }
     if (isset($requires->elefant) && version_compare(ELEFANT_VERSION, $requires->elefant) < 0) {
         self::$error = i18n_getf('Verification failed: This install requires Elefant %s or newer.', $requires->elefant);
         return false;
     }
     return true;
 }
 /**
  * copy customized extension.yml, classes and templates to silverstripe project which should be availible as skelet
  */
 public static function add()
 {
     File::copy(Installer::getRootDirVendor() . static::getExtension(), Installer::getRootDirConfig());
     Installer::getComposerEvent()->getIO()->write(":: copied " . self::getConfigfile());
     foreach (static::getClasses() as $folder => $class) {
         File::copy(Installer::getRootDirVendor() . $class, Installer::getRootDirCode() . $folder . "/");
         Installer::getComposerEvent()->getIO()->write(":: added class {$class}");
     }
     foreach (static::getTemplates() as $folder => $template) {
         File::copy(Installer::getRootDirVendor() . $template, Installer::getRootDirTheme() . $folder . "/");
         Installer::getComposerEvent()->getIO()->write(":: added template {$template}");
     }
 }
Ejemplo n.º 27
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $force = $input->getOption('force');
     $installer = new \Installer();
     $installed = $installer->tableExists('users_users');
     if (!$installed || $force) {
         $installer->cleanInstall();
         $output->writeln('Installation completed.');
         $output->writeln('<info>Queries executed successfully: ' . count($installer->success) . '</info>');
         if (count($installer->failures)) {
             foreach ($installer->failures as $key => $error) {
                 list($query, $message, $patch) = $error;
                 $output->writeln("<error>Error {$key} in {$patch}\n\t{$query}\n\t{$message}</error>");
             }
         }
         global $cachelib;
         require_once 'lib/cache/cachelib.php';
         $cachelib->empty_cache();
     } else {
         $output->writeln('<error>Database already exists.</error>');
     }
 }
Ejemplo n.º 28
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $force = $input->getOption('force');
     $installer = new \Installer();
     $installed = $installer->tableExists('users_users');
     if (!$installed || $force) {
         $installer->cleanInstall();
         $output->writeln('Installation completed.');
         $output->writeln('<info>Queries executed successfully: ' . count($installer->success) . '</info>');
         if (count($installer->failures)) {
             foreach ($installer->failures as $key => $error) {
                 list($query, $message, $patch) = $error;
                 $output->writeln("<error>Error {$key} in {$patch}\n\t{$query}\n\t{$message}</error>");
             }
         }
         include_once 'tiki-setup.php';
         \TikiLib::lib('cache')->empty_cache();
         initialize_prefs(true);
         \TikiLib::lib('unifiedsearch')->rebuild();
     } else {
         $output->writeln('<error>Database already exists.</error>');
     }
 }
Ejemplo n.º 29
0
 /**
  * Overrides the default `initialiseDatabase()` method
  * This allows us to still use the normal accessor
  */
 public function initialiseDatabase()
 {
     parent::setDatabase();
     $details = Symphony::Configuration()->get('database');
     try {
         Symphony::Database()->connect($details['host'], $details['user'], $details['password'], $details['port'], $details['db']);
     } catch (DatabaseException $e) {
         self::__abort('There was a problem while trying to establish a connection to the MySQL server. Please check your settings.', $start);
     }
     // MySQL: Setting prefix & character encoding
     Symphony::Database()->setPrefix($details['tbl_prefix']);
     Symphony::Database()->setCharacterEncoding();
     Symphony::Database()->setCharacterSet();
 }
 /**
  * Register hooks and load options.
  *
  * @since 1.0.0
  *
  * @uses Registry::load() to load the options.
  * @uses Loader::register_hooks() to setup plugin management.
  * @uses System::register_hooks() to setup global functionality.
  * @uses Backend::register_hooks() to setup backend functionality.
  * @uses AJAX::register_hooks() to setup AJAX functionality.
  * @uses Manager::register_hooks() to setup admin screens.
  * @uses Documenter::register_hooks() to setup admin documentation.
  */
 public static function setup()
 {
     // Setup the registry
     Registry::load();
     // Register the Installer stuff
     Installer::register_hooks();
     // Register global hooks
     self::register_hooks();
     // Register the hooks of the subsystems
     Backend::register_hooks();
     AJAX::register_hooks();
     Manager::register_hooks();
     Documenter::register_hooks();
 }