本文整理汇总了PHP中Installer::install方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::install方法的具体用法?PHP Installer::install怎么用?PHP Installer::install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::install方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Installer
function com_install()
{
register_shutdown_function("deleteExtFolder");
$installer = new Installer();
$installer->install();
return true;
}
示例2: com_install
function com_install()
{
$installer = new Installer();
// echo "<H3>Installing Universal AJAX Live Search component and module Success</h3>";
$installer->install();
return true;
}
示例3: 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');
}
示例4: _execute
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())));
}
}
示例5: str_replace
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace Pasteque;
if (isset($_POST['install'])) {
$country = $_POST['install'];
$country = str_replace("..", "", $country);
Installer::install($country);
} else {
if (isset($_POST['update'])) {
$country = $_POST['country'];
$country = str_replace("..", "", $country);
Installer::upgrade($country);
}
}
function show_install()
{
tpl_open();
?>
<h1><?php
\pi18n("Installation");
?>
</h1>
示例6: Installer
<?php
/**
* Part of CI PHPUnit Test
*
* @author Kenji Suzuki <https://github.com/kenjis>
* @license MIT License
* @copyright 2015 Kenji Suzuki
* @link https://github.com/kenjis/ci-phpunit-test
*/
require __DIR__ . '/Installer.php';
$installer = new Installer();
$installer->install();
示例7: vce_activation
function vce_activation()
{
$installerVCE = new Installer();
$installerVCE->install();
}
示例8: __construct
#!/usr/bin/env php
<?php
$installer = new Installer();
if ($argc === 3) {
$package = $argv[1];
$version = $argv[2];
echo $installer->install($package, $version);
} else {
echo $installer->usage($argv[0]);
}
class Installer
{
protected $tmp_dir;
protected $packages = array();
public function __construct()
{
$this->tmp_dir = __DIR__ . '/tmp';
@mkdir($this->tmp_dir);
$this->packages = array('translations' => array('site' => 'github', 'user' => 'bcit-ci', 'repos' => 'codeigniter3-translations', 'name' => 'Translations for CodeIgniter System Messages', 'dir' => 'language', 'example_branch' => '3.0.0'));
}
public function usage($self)
{
$msg = 'You can install:' . PHP_EOL;
foreach ($this->packages as $key => $value) {
$msg .= ' ' . $value['name'] . ' (' . $key . ')' . PHP_EOL;
}
$msg .= PHP_EOL;
$msg .= 'Usage:' . PHP_EOL;
$msg .= ' php install.php <package> <version/branch>' . PHP_EOL;
$msg .= PHP_EOL;
$msg .= 'Examples:' . PHP_EOL;
示例9: commit
/**
* Install packages slated for installation during transaction
*/
static function commit()
{
if (static::$inTransaction === false) {
return false;
}
try {
static::preCommitDependencyResolve();
$installer = new Installer();
// validate dependencies
$errs = new \PEAR2\MultiErrors();
foreach (static::$installPackages as $package) {
$package->validateDependencies(static::$installPackages, $errs);
}
if (count($errs->E_ERROR)) {
throw new Installer\Exception('Dependency validation failed ' . 'for some packages to install, installation aborted', $errs);
}
// download non-local packages
foreach (static::$installPackages as $package) {
$fullPackageName = $package->channel . '/' . $package->name;
Logger::log(1, 'Downloading ' . $fullPackageName);
$package->download();
if ($package->isPlugin()) {
// check for downloaded packages
if (!isset(Main::$options['install-plugins'])) {
// Check the plugin registry so we can provide more info
$command = 'install';
if (Config::current()->pluginregistry->exists($package->name, $package->channel)) {
$command = 'upgrade';
}
Logger::log(0, 'Skipping plugin ' . $fullPackageName . PHP_EOL . 'Plugins modify the installer and cannot be installed at the same time as regular packages.' . PHP_EOL . 'Add the -p option to manage plugins, for example:' . PHP_EOL . ' php pyrus.phar ' . $command . ' -p ' . $fullPackageName);
unset(static::$installPackages[$fullPackageName]);
}
}
}
// now validate everything to the fine-grained level
foreach (static::$installPackages as $package) {
$package->validate(Validate::INSTALLING);
}
// create dependency connections and load them into the directed graph
$graph = new DirectedGraph();
foreach (static::$installPackages as $package) {
$package->makeConnections($graph, static::$installPackages);
}
// topologically sort packages and install them via iterating over the graph
$packages = $graph->topologicalSort();
$reg = Config::current()->registry;
try {
AtomicFileTransaction::begin();
$reg->begin();
if (isset(Main::$options['upgrade'])) {
foreach ($packages as $package) {
$fullPackageName = $package->channel . '/' . $package->name;
if ($reg->exists($package->name, $package->channel)) {
static::$wasInstalled[$fullPackageName] = $reg->package[$fullPackageName];
$reg->uninstall($package->name, $package->channel);
}
}
}
static::detectDownloadConflicts($packages, $reg);
foreach ($packages as $package) {
if (isset(static::$installedPackages[$package->channel . '/' . $package->name])) {
continue;
}
$installer->install($package);
static::$installedPackages[$package->channel . '/' . $package->name] = $package;
}
foreach (static::$installedPackages as $package) {
try {
$previous = $reg->toPackageFile($package->name, $package->channel, true);
} catch (\Exception $e) {
$previous = null;
}
$reg->install($package->getPackageFile()->info);
static::$registeredPackages[] = array($package, $previous);
}
static::$installPackages = array();
AtomicFileTransaction::commit();
$reg->commit();
} catch (AtomicFileTransaction\Exception $e) {
$errs = new \PEAR2\MultiErrors();
$errs->E_ERROR[] = $e;
try {
AtomicFileTransaction::rollback();
} catch (\Exception $ex) {
$errs->E_WARNING[] = $ex;
}
try {
$reg->rollback();
} catch (\Exception $ex) {
$errs->E_WARNING[] = $ex;
}
throw new Installer\Exception('Installation failed', $errs);
}
Config::current()->saveConfig();
// success
AtomicFileTransaction::removeBackups();
static::$inTransaction = false;
//.........这里部分代码省略.........
示例10: Installer
<?php
/**
* Part of ci-phpunit-test
*
* @author Kenji Suzuki <https://github.com/kenjis>
* @license MIT License
* @copyright 2015 Kenji Suzuki
* @link https://github.com/kenjis/ci-phpunit-test
*/
require __DIR__ . '/Installer.php';
$app = 'application';
if (isset($argv[1]) && is_dir($argv[1])) {
$app = $argv[1];
}
$installer = new Installer();
$installer->install($app);
示例11: Installer
// CLI-install error message. exit(1) will halt any makefile.
if($installFromCli && ($req->hasErrors() || $dbReq->hasErrors())) {
echo "Cannot install due to errors:\n";
$req->listErrors();
$dbReq->listErrors();
exit(1);
}
if((isset($_REQUEST['go']) || $installFromCli) && !$req->hasErrors() && !$dbReq->hasErrors() && $adminConfig['username'] && $adminConfig['password']) {
// Confirm before reinstalling
if(!isset($_REQUEST['force_reinstall']) && !$installFromCli && $alreadyInstalled) {
include('sapphire/dev/install/config-form.html');
} else {
$inst = new Installer();
if($_REQUEST) $inst->install($_REQUEST);
else $inst->install(array(
'database' => $databaseConfig['type'],
'mysql' => $databaseConfig,
'admin' => $adminConfig,
));
}
// Show the config form
} else {
include('sapphire/dev/install/config-form.html');
}
/**
* This class checks requirements
* Each of the requireXXX functions takes an argument which gives a user description of the test. It's an array
示例12: setUpBeforeClass
public static function setUpBeforeClass()
{
// Install empty database
Installer::install(null);
}
示例13: elseif
$_SESSION['ost_installer']['s'] = 'config';
} else {
$errors['prereq'] = __('Minimum requirements not met!');
}
break;
case 'config':
if (!$installer->config_exists()) {
$errors['err'] = __('Configuration file does NOT exist. Follow steps below to add one.');
} elseif (!$installer->config_writable()) {
$errors['err'] = __('Write access required to continue');
} else {
$_SESSION['ost_installer']['s'] = 'install';
}
break;
case 'install':
if ($installer->install($_POST)) {
$_SESSION['info'] = array('name' => ucfirst($_POST['fname'] . ' ' . $_POST['lname']), 'email' => $_POST['admin_email'], 'URL' => URL);
//TODO: Go to subscribe step.
$_SESSION['ost_installer']['s'] = 'done';
} elseif (!($errors = $installer->getErrors()) || !$errors['err']) {
$errors['err'] = __('Error installing osTicket - correct the errors below and try again.');
}
break;
case 'subscribe':
if (!trim($_POST['name'])) {
$errors['name'] = __('Required');
}
if (!$_POST['email']) {
$errors['email'] = __('Required');
} elseif (!Validator::is_valid_email($_POST['email'])) {
$errors['email'] = __('Invalid');
示例14: isset
$installFromCli = isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'install';
// CLI-install error message. exit(1) will halt any makefile.
if ($installFromCli && ($req->hasErrors() || $dbReq->hasErrors())) {
echo "Cannot install due to errors:\n";
$req->listErrors();
$dbReq->listErrors();
exit(1);
}
if ((isset($_REQUEST['go']) || $installFromCli) && !$req->hasErrors() && !$dbReq->hasErrors() && $adminConfig['username'] && $adminConfig['password']) {
// Confirm before reinstalling
if (!$installFromCli && $alreadyInstalled) {
include FRAMEWORK_NAME . '/dev/install/config-form.html';
} else {
$inst = new Installer();
if ($_REQUEST) {
$inst->install($_REQUEST);
} else {
$inst->install(array('db' => $databaseConfig, 'admin' => $adminConfig));
}
}
// Show the config form
} else {
include FRAMEWORK_NAME . '/dev/install/config-form.html';
}
/**
* This class checks requirements
* Each of the requireXXX functions takes an argument which gives a user description of the test.
* It's an array of 3 parts:
* $description[0] - The test catetgory
* $description[1] - The test title
* $description[2] - The test error to show, if it goes wrong
示例15: install_9
public function install_9()
{
if ($this->accessAdminPage(1)) {
require_once dirname(__FILE__) . '/resources/install.php';
$installer = new Installer($this->parent);
return $installer->install(9);
} else {
$this->parent->parent->addHeader('Location', '/admin/modules/');
return new ActionResult($this, '/admin/modules/', 1, 'You are not allowed to do that', B_T_FAIL);
}
}