本文整理汇总了PHP中Installer类的典型用法代码示例。如果您正苦于以下问题:PHP Installer类的具体用法?PHP Installer怎么用?PHP Installer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Installer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeSaveData
/**
* 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;
}
示例2: execute
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>');
}
}
示例3: testPasswordIsInvalid
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());
}
示例4: testAvailableProfilesConformToSchema
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, 'info@collectiveaccess.org', false, false);
$this->assertEquals(0, $vo_installer->numErrors(), "The profile '{$vs_profile}' doesn't conform to the XML schema");
}
}
示例5: uninstall
/**
* 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();
}
}
}
示例6: downloadLanguage
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;
}
示例7: update
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;
}
示例8: create
/**
* 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);
}
示例9: getHTML
function getHTML($smarty)
{
$smarty->assign_by_ref('field', $this);
$output = $smarty->fetch(Installer::getTemplatePath("field_{$this->type}.tpl"));
$smarty->clear_assign('field');
return $output;
}
示例10: __construct
public function __construct($VariablesArray)
{
Installer::$DBConnection = $VariablesArray[0]::$Connection;
Installer::$CConnection = $VariablesArray[0]::$CConnection;
Installer::$WConnection = $VariablesArray[0]::$WConnection;
Installer::$TM = $VariablesArray[1];
}
示例11: dataDirOKmaybeCreate
/**
* @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();
}
示例12: run
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();
}
示例13: instance
/**
* 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;
}
示例14: update
/**
* 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;
}
示例15: action_go
/**
*
* @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');
}