本文整理汇总了PHP中PluginManager::installPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::installPlugin方法的具体用法?PHP PluginManager::installPlugin怎么用?PHP PluginManager::installPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::installPlugin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install()
{
$request =& HTTPRequest::instance();
$name = $request->get('name');
if ($name) {
$this->plugin_manager->installPlugin($name);
}
}
示例2: activatePlugin
function activatePlugin($name) {
$plugin_factory = PluginFactory::instance();
$plugin = $plugin_factory->getPluginByName($name);
if (! $plugin) {
echo "Install plugin\n";
$plugin_manager = new PluginManager();
$plugin = $plugin_manager->installPlugin($name);
}
if (! $plugin_factory->isPluginAvailable($plugin)) {
echo "Activate plugin\n";
$plugin_factory->availablePlugin($plugin);
}
}
示例3: dirname
*/
require_once dirname(__FILE__) . '/../../includes/core/init.php';
$self = array_shift($argv);
$action = array_shift($argv);
$target = array_shift($argv);
if (!in_array($action, array('install', 'update', 'uninstall'))) {
die('Unknown action "' . $action . '", see "help"' . "\n");
}
if ($action == 'help') {
echo 'Usage : ' . $self . ' <action> <target>' . "\n";
echo "\n";
echo "\t" . 'action must be "install", "update" or "uninstall"' . "\n";
echo "\t" . 'target is the name of th plugin to act upon' . "\n";
exit(0);
}
try {
switch ($action) {
case 'install':
PluginManager::installPlugin($target);
break;
case 'update':
PluginManager::updatePlugin($target);
break;
case 'uninstall':
PluginManager::uninstallPlugin($target);
break;
}
} catch (Exception $e) {
die('Exception : ' . $e->getMessage() . "\n");
}
exit(0);
示例4: testInstallPlugin
function testInstallPlugin()
{
$GLOBALS['sys_pluginsroot'] = dirname(__FILE__) . '/test/custom/';
$GLOBALS['sys_custompluginsroot'] = dirname(__FILE__) . '/test/custom/';
$GLOBALS['sys_pluginsroot'] = dirname(__FILE__) . '/test/custom/';
mkdir(dirname(__FILE__) . '/test');
mkdir(dirname(__FILE__) . '/test/custom');
//The plugins
$plugin = new MockPlugin($this);
//The plugin factory
$plugin_factory = new MockPluginFactory($this);
$plugin_factory->expectOnce('createPlugin', array('New_Plugin'));
$plugin_factory->setReturnReference('createPlugin', $plugin);
stub($plugin_factory)->getAllPossiblePluginsDir()->returns(array(dirname(__FILE__) . '/test'));
$forgeupgrade_config = mock('ForgeUpgradeConfig');
expect($forgeupgrade_config)->addPath($GLOBALS['sys_pluginsroot'] . 'New_Plugin')->once();
expect($forgeupgrade_config)->recordOnlyPath($GLOBALS['sys_pluginsroot'] . 'New_Plugin')->once();
//The plugins manager
$pm = new PluginManager($plugin_factory, mock('EventManager'), mock('SiteCache'), $forgeupgrade_config);
$this->assertReference($pm->installPlugin('New_Plugin'), $plugin);
// plugin manager must call postInstall 1 time on plugin after its creation
$plugin->expectCallCount('postInstall', 1);
// Plugin dir was created in "/etc"
$this->assertTrue(is_dir(dirname(__FILE__) . '/test/custom/New_Plugin'));
$this->_remove_directory(dirname(__FILE__) . '/test');
}