本文整理匯總了PHP中Install類的典型用法代碼示例。如果您正苦於以下問題:PHP Install類的具體用法?PHP Install怎麽用?PHP Install使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Install類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: install
public function install()
{
$install = new Install($this->m_db);
if ($install->init()) {
echo '<h2>Installation succeeded.</h2>
<p><a href="./">Go to application</a><p>';
} else {
echo '<h2>Installation failed.</h2>';
}
}
示例2: testManageTicketClosed
public function testManageTicketClosed()
{
global $DB;
$DB->connect();
$Install = new Install();
$Install->testInstall(0);
$this->manageTicket();
$this->states();
$this->groups();
$this->totaltimeEnddateOfTicket();
$this->displayGroups();
}
示例3: executePluginTest
/**
* Executes the plug-in test.
* @param $pluginCategory string
* @param $pluginDir string
* @param $pluginName string
* @param $filterGroups array
*/
protected function executePluginTest($pluginCategory, $pluginDir, $pluginName, $filterGroups)
{
// Make sure that the xml configuration is valid.
$filterConfigFile = 'plugins/' . $pluginCategory . '/' . $pluginDir . '/filter/' . PLUGIN_FILTER_DATAFILE;
$this->validateXmlConfig(array('./' . $filterConfigFile, './lib/pkp/' . $filterConfigFile));
// Make sure that data from earlier tests is being deleted first.
$filterDao =& DAORegistry::getDAO('FilterDAO');
/* @var $filterDao FilterDAO */
foreach ($filterGroups as $filterGroupSymbolic) {
foreach ($filterDao->getObjectsByGroup($filterGroupSymbolic) as $filter) {
$filterDao->deleteObject($filter);
}
foreach ($filterDao->getObjectsByGroup($filterGroupSymbolic, 0, true) as $filter) {
$filterDao->deleteObject($filter);
}
}
$filterGroupDao =& DAORegistry::getDAO('FilterGroupDAO');
/* @var $filterGroupDao FilterGroupDAO */
foreach ($filterGroups as $filterGroupSymbolic) {
$filterGroupDao->deleteObjectBySymbolic($filterGroupSymbolic);
}
// Mock request and router.
import('lib.pkp.classes.core.PKPRouter');
import('classes.core.Request');
$mockRequest = $this->getMock('Request', array('getRouter', 'getUser'));
$router = new PKPRouter();
$mockRequest->expects($this->any())->method('getRouter')->will($this->returnValue($router));
$mockRequest->expects($this->any())->method('getUser')->will($this->returnValue(null));
Registry::set('request', $mockRequest);
// Instantiate the installer.
import('classes.install.Install');
$installFile = './lib/pkp/tests/plugins/testPluginInstall.xml';
$params = $this->getConnectionParams();
$installer = new Install($params, $installFile, true);
// Parse the plug-ins version.xml.
import('lib.pkp.classes.site.VersionCheck');
self::assertFileExists($versionFile = './plugins/' . $pluginCategory . '/' . $pluginDir . '/version.xml');
self::assertArrayHasKey('version', $versionInfo =& VersionCheck::parseVersionXML($versionFile));
self::assertType('Version', $pluginVersion =& $versionInfo['version']);
$installer->setCurrentVersion($pluginVersion);
// Install the plug-in.
self::assertTrue($installer->execute());
// Reset the hook registry.
Registry::set('hooks', $nullVar = null);
// Test whether the installation is idempotent.
self::assertTrue($installer->execute());
// Test whether the filter groups have been installed.
foreach ($filterGroups as $filterGroupSymbolic) {
// Check the group.
self::assertType('FilterGroup', $filterGroupDao->getObjectBySymbolic($filterGroupSymbolic), $filterGroupSymbolic);
}
}
示例4: initDbConstants
/**
* Initialize database constants to connect
*
* @param Install $install Installer
*
* @return void
*/
function initDbConstants($install)
{
define('TYPE_DB', $install->getDbType());
define('PREFIX_DB', $install->getTablesPrefix());
define('USER_DB', $install->getDbUser());
define('PWD_DB', $install->getDbPass());
define('HOST_DB', $install->getDbHost());
define('PORT_DB', $install->getDbPort());
define('NAME_DB', $install->getDbName());
}
示例5: main
function main($ini_file)
{
$install = new Install($ini_file);
$response = $install->step1();
if (is_array($response)) {
$install->print_errors($response);
}
$response = $install->step2();
if (is_array($response)) {
$install->print_errors($response);
}
$response = $install->step3();
if (is_array($response)) {
$install->print_errors($response);
}
$response = $install->step4();
if (is_array($response)) {
$install->print_errors($response);
}
exit(1);
}
示例6: install
/**
* Perform installation.
*/
function install()
{
$installer = new Install($this->params);
$installer->setLogger($this);
if ($installer->execute()) {
if (count($installer->getNotes()) > 0) {
printf("\nRelease Notes\n");
printf("----------------------------------------\n");
foreach ($installer->getNotes() as $note) {
printf("%s\n\n", $note);
}
}
if (!$installer->wroteConfig()) {
printf("\nNew config.inc.php:\n");
printf("----------------------------------------\n");
echo $installer->getConfigContents();
printf("----------------------------------------\n");
}
$newVersion =& $installer->getNewVersion();
printf("Successfully installed version %s\n", $newVersion->getVersionString(false));
} else {
printf("ERROR: Installation failed: %s\n", $installer->getErrorString());
}
}
示例7: init
/**
* Singleton.
*/
protected function init()
{
$install = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_install', Install::get_called_class());
$uninstall = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_uninstall', Uninstall::get_called_class());
$update = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_update', Update::get_called_class());
$admin = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_admin', Admin::get_called_class());
$shortcode = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_shortcode', ShortCode::get_called_class());
$view = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_view', View::get_called_class());
$install::get_instance();
$uninstall::get_instance();
$update::get_instance();
$admin::get_instance();
$shortcode::get_instance();
$view::get_instance();
add_image_size(VA_SOCIALBUZZ_PREFIX . 'thumbnail', '980', '9999', false);
// Recommend you don't use this short code registering your own post data.
add_shortcode('socialbuzz', array(&$this, 'add_shortcode'));
if (!is_admin()) {
add_action('wp_enqueue_scripts', array(&$this, 'wp_enqueue_scripts'), 15);
add_filter('the_content', array(&$this, 'the_content'));
}
}
示例8: setUp
protected function setUp()
{
parent::setUp();
$params = array('host' => 'localhost', 'username' => 'usvn-test', 'password' => 'usvn-test', 'dbname' => 'usvn-test');
if (getenv('DB') == "PDO_SQLITE" || getenv('DB') === false) {
$this->_clean();
Install::installDb('tests/db.ini', dirname(__FILE__) . '/../../SQL/', 'localhost', 'usvn-test', 'usvn-test', 'tests/usvn.db', 'usvn_', 'PDO_SQLITE', false);
$params['dbname'] = "tests/usvn.db";
$this->db = Zend_Db::factory('PDO_SQLITE', $params);
file_put_contents('tests/test.ini', '
database.adapterName = "PDO_SQLITE"
database.prefix = "usvn_"
database.options.host = "localhost"
database.options.username = "usvn-test"
database.options.password = "usvn-test"
database.options.dbname = "' . getcwd() . '/tests/usvn.db"
subversion.passwd = "' . getcwd() . '/tests/htpasswd"
', FILE_APPEND);
} else {
$this->db = Zend_Db::factory(getenv('DB'), $params);
$this->_clean();
Install::installDb('tests/db.ini', dirname(__FILE__) . '/../../SQL/', 'localhost', 'usvn-test', 'usvn-test', 'usvn-test', 'usvn_', getenv('DB'), false);
file_put_contents('tests/test.ini', '
database.adapterName = "' . getenv('DB') . '"
database.prefix = "usvn_"
database.options.host = "localhost"
database.options.username = "usvn-test"
database.options.password = "usvn-test"
database.options.dbname = "usvn-test"
subversion.passwd = "' . getcwd() . '/tests/htpasswd"
', FILE_APPEND);
}
Zend_Db_Table::setDefaultAdapter($this->db);
USVN_Db_Table::$prefix = "usvn_";
$config = new USVN_Config_Ini('tests/test.ini', 'general');
Zend_Registry::set('config', $config);
}
示例9: session_start
<?php
require_once '__conf.php';
require_once 'inc/Connection.class.php';
require_once 'inc/Install.class.php';
require_once 'inc/ServiceTree.class.php';
session_start();
function_exists('curl_init') or die('cURL module not found.');
$dbh = Connection::GetDatabase();
Install::CheckDbTables($dbh);
$colors = ServiceTree::GetColors($dbh);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="icon" type="image/x-icon" href="img/favicon.ico"/>
<?php
require_once 'i18n/i18n.php';
i18n_set_map('en', $LANG);
?>
<style type="text/css">
html,body { height:100%; margin:0; overflow:hidden; }
body,table,input,select { font:10pt Arial; color:#181818; }
a { color:#1853AD; }
a:hover { color:#FE5E00; }
hr { height:1px; border:0; color:#CCC; background-color:#CCC; }
div#theBigOne { width:100%; height:100%; background:url('img/serpro.png') no-repeat bottom right; }
#treeLoading { position:fixed; top:50%; left:50%; margin-top:-75px; margin-left:-75px; }
/*canvas#treePlot { width:100%; height:100%; }*/
示例10: installPlugin
/**
* Installs the uploaded plugin
* @param $path string path to plugin Directory
* @param $templateMgr reference to template manager
* @return boolean
*/
function installPlugin($path, &$templateMgr)
{
$this->validate();
$versionFile = $path . VERSION_FILE;
$templateMgr->assign('error', true);
$templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true));
$pluginVersion =& VersionCheck::getValidPluginVersionInfo($versionFile, $templateMgr);
if (is_null($pluginVersion)) {
return false;
}
assert(is_a($pluginVersion, 'Version'));
$versionDao =& DAORegistry::getDAO('VersionDAO');
/* @var $versionDao VersionDAO */
$installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProductType(), $pluginVersion->getProduct(), true);
if (!$installedPlugin) {
$pluginLibDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . strtr($pluginVersion->getProductType(), '.', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pluginVersion->getProduct();
$pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . strtr($pluginVersion->getProductType(), '.', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pluginVersion->getProduct();
// Copy the plug-in from the temporary folder to the
// target folder.
// Start with the library part (if any).
$libPath = $path . DIRECTORY_SEPARATOR . 'lib';
if (is_dir($libPath)) {
if (!FileManager::copyDir($libPath, $pluginLibDest)) {
$templateMgr->assign('message', 'manager.plugins.copyError');
return false;
}
// Remove the library part of the temporary folder.
FileManager::rmtree($libPath);
}
// Continue with the application-specific part (mandatory).
if (!FileManager::copyDir($path, $pluginDest)) {
$templateMgr->assign('message', 'manager.plugins.copyError');
return false;
}
// Remove the temporary folder.
FileManager::rmtree(dirname($path));
// Upgrade the database with the new plug-in.
$installFile = $pluginDest . INSTALL_FILE;
if (!is_file($installFile)) {
$installFile = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'defaultPluginInstall.xml';
}
assert(is_file($installFile));
$params = $this->_setConnectionParams();
$installer = new Install($params, $installFile, true);
$installer->setCurrentVersion($pluginVersion);
if (!$installer->execute()) {
// Roll back the copy
if (is_dir($pluginLibDest)) {
FileManager::rmtree($pluginLibDest);
}
if (is_dir($pluginDest)) {
FileManager::rmtree($pluginDest);
}
$templateMgr->assign('message', array('manager.plugins.installFailed', $installer->getErrorString()));
return false;
}
$message = array('manager.plugins.installSuccessful', $pluginVersion->getVersionString());
$templateMgr->assign('message', $message);
$templateMgr->assign('uploaded', true);
$templateMgr->assign('error', false);
$versionDao->insertVersion($pluginVersion, true);
return true;
} else {
if ($this->_checkIfNewer($pluginVersion->getProductType(), $pluginVersion->getProduct(), $pluginVersion)) {
$templateMgr->assign('message', 'manager.plugins.pleaseUpgrade');
return false;
} else {
$templateMgr->assign('message', 'manager.plugins.installedVersionOlder');
return false;
}
}
}
示例11: error_reporting
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
include_once 'install.class.php';
include_once 'db.class.php';
@ini_set("display_erros", "Off");
@ini_set("display_startup_errors", "Off");
error_reporting(0);
$install = new Install();
# installation configiration
define("SP_UPGRADE_VERSION", '2.0.0');
define("SP_INSTALL_DIR", getcwd());
define("SP_CONFIG_FILE", "config/sp-config.php");
define("SP_UPGRADE_DB_FILE", SP_INSTALL_DIR . "/data/upgrade.sql");
define("SP_UPGRADE_DB_LANG_FILE", SP_INSTALL_DIR . "/data/textlang.sql");
define("SP_INSTALL_CONFIG_FILE", SP_INSTALL_DIR . "/../" . SP_CONFIG_FILE);
$install->showDefaultHeader();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
switch ($_POST['sec']) {
case "proceedupgrade":
$install->proceedUpgrade($_POST);
break;
}
} else {
示例12: set_time_limit
<?php
set_time_limit(0);
include_once "config.inc.php";
include_once "templates/header.html";
include_once "templates/install_manager_sidebar.html";
$mysql = new Mysql();
$install = new Install();
$monitor = new NodeMonitor();
if (!@$_GET['action']) {
echo '<div class="span10">
' . $lang['chooseLeftSidebar'] . '
</div>';
} elseif ($_GET['action'] == "Install") {
if (!$_GET['ip']) {
echo '<div class=span10>';
echo '<h2>' . $lang['chooseInstallHost'] . '</h2>';
$sql = "select * from ehm_hosts order by create_time desc";
$mysql->Query($sql);
echo '<table class="table table-striped">';
echo '<thead>
<tr>
<th>#</th>
<th>' . $lang['hostname'] . '</th>
<th>' . $lang['ipAddr'] . '</th>
<th>' . $lang['nodeRole'] . '</th>
<th>' . $lang['createTime'] . '</th>
<th>' . $lang['action'] . '</th>
</tr>
</thead>
<tbody>';
示例13: installPlugin
/**
* Installs an extracted plugin
* @param $path string path to plugin Directory
* @param $errorMsg string Reference to string receiving error message
* @return Version|null Version of installed plugin on success
*/
function installPlugin($path, &$errorMsg)
{
$versionFile = $path . '/' . PLUGIN_VERSION_FILE;
$pluginVersion = VersionCheck::getValidPluginVersionInfo($versionFile, $errorMsg);
if (!$pluginVersion) {
return null;
}
$versionDao = DAORegistry::getDAO('VersionDAO');
/* @var $versionDao VersionDAO */
$installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProductType(), $pluginVersion->getProduct(), true);
if (!$installedPlugin) {
$pluginLibDest = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/' . strtr($pluginVersion->getProductType(), '.', '/') . '/' . $pluginVersion->getProduct();
$pluginDest = Core::getBaseDir() . '/' . strtr($pluginVersion->getProductType(), '.', '/') . '/' . $pluginVersion->getProduct();
// Copy the plug-in from the temporary folder to the
// target folder.
// Start with the library part (if any).
$libPath = $path . '/lib';
$fileManager = new FileManager();
if (is_dir($libPath)) {
if (!$fileManager->copyDir($libPath, $pluginLibDest)) {
$errorMsg = __('manager.plugins.copyError');
return null;
}
// Remove the library part of the temporary folder.
$fileManager->rmtree($libPath);
}
// Continue with the application-specific part (mandatory).
if (!$fileManager->copyDir($path, $pluginDest)) {
$errorMsg = __('manager.plugins.copyError');
return null;
}
// Remove the temporary folder.
$fileManager->rmtree(dirname($path));
// Upgrade the database with the new plug-in.
$installFile = $pluginDest . '/' . PLUGIN_INSTALL_FILE;
if (!is_file($installFile)) {
$installFile = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/xml/defaultPluginInstall.xml';
}
assert(is_file($installFile));
$params = $this->_getConnectionParams();
$installer = new Install($params, $installFile, true);
$installer->setCurrentVersion($pluginVersion);
if (!$installer->execute()) {
// Roll back the copy
if (is_dir($pluginLibDest)) {
$fileManager->rmtree($pluginLibDest);
}
if (is_dir($pluginDest)) {
$fileManager->rmtree($pluginDest);
}
$errorMsg = __('manager.plugins.installFailed', array('errorString' => $installer->getErrorString()));
return null;
}
$versionDao->insertVersion($pluginVersion, true);
return $pluginVersion;
} else {
if ($this->_checkIfNewer($pluginVersion->getProductType(), $pluginVersion->getProduct(), $pluginVersion)) {
$errorMsg = __('manager.plugins.pleaseUpgrade');
} else {
$errorMsg = __('manager.plugins.installedVersionOlder');
}
}
return null;
}
示例14: Install
//實例化模型類
$sql = "CREATE DATABASE IF NOT EXISTS `" . $config['DB_NAME'] . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
$model->query($sql);
//如果指定數據庫不存在,則嘗試創建
$model->db->select_db($config['DB_NAME']);
//選擇數據庫
$ins = new Install();
//實例化數據庫安裝類
$DB_PREFIX = in($_POST['DB_PREFIX']);
if (empty($DB_PREFIX)) {
$DB_PREFIX = 'dc_';
}
if ($_POST['test']) {
$sql_array = Install::mysql('../data/test.sql', 'dc_', $DB_PREFIX);
} else {
$sql_array = Install::mysql('../data/db.sql', 'dc_', $DB_PREFIX);
}
//執行數據庫操作
foreach ($sql_array as $sql) {
$model->db->query($sql);
//安裝數據
}
//修改配置文件
$config_array = array();
foreach ($config as $key => $value) {
$config_array["config['" . $key . "']"] = $value;
}
if (!set_config($config_array)) {
cpError::show('配置文件寫入失敗!');
}
//安裝成功,創建鎖定文件
示例15: exit
* WoWRoster.net WoWRoster
*
* Roster plugin admin
*
*
* @copyright 2002-2011 WoWRoster.net
* @license http://www.gnu.org/licenses/gpl.html Licensed under the GNU General Public License v3.
* @package WoWRoster
* @subpackage RosterCP
*/
if (!defined('IN_ROSTER') || !defined('IN_ROSTER_ADMIN')) {
exit('Detected invalid access to this file!');
}
include ROSTER_ADMIN . 'roster_config_functions.php';
include ROSTER_LIB . 'install.lib.php';
$installer = new Install('plugins');
$installer->conf_table = 'plugin_config';
$op = isset($_POST['op']) ? $_POST['op'] : '';
$id = isset($_POST['id']) ? $_POST['id'] : '';
switch ($op) {
case 'deactivate':
processActive($id, 0);
break;
case 'activate':
processActive($id, 1);
break;
case 'process':
$processed = processPlugin();
break;
default:
break;