本文整理匯總了PHP中JInstaller::getParams方法的典型用法代碼示例。如果您正苦於以下問題:PHP JInstaller::getParams方法的具體用法?PHP JInstaller::getParams怎麽用?PHP JInstaller::getParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JInstaller
的用法示例。
在下文中一共展示了JInstaller::getParams方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: installModules
/**
* Installs modules that come with the package
*
* @param array $modulesToInstall - modues that need to be installed
*
* @return array
*/
public function installModules($modulesToInstall)
{
$src = $this->parent->getParent()->getPath('source');
$status = array();
// Modules installation
if (count($modulesToInstall)) {
foreach ($modulesToInstall as $folder => $modules) {
if (count($modules)) {
foreach ($modules as $module => $modulePreferences) {
// Install the module
if (empty($folder)) {
$folder = 'site';
}
$path = "{$src}/modules/{$module}";
if ($folder == 'admin') {
$path = "{$src}/administrator/modules/{$module}";
}
if (!is_dir($path)) {
continue;
}
$db = JFactory::getDbo();
// Was the module alrady installed?
$query = $db->getQuery('true');
$query->select('COUNT(*)')->from($db->qn('#__modules'))->where($db->qn('module') . '=' . $db->q($module));
$db->setQuery($query);
$count = $db->loadResult();
$installer = new JInstaller();
$result = $installer->install($path);
$status[] = array('name' => $module, 'client' => $folder, 'result' => $result);
// Modify where it's published and its published state
if (!$count) {
list($modulePosition, $modulePublished) = $modulePreferences;
$query->clear();
$query->update($db->qn('#__modules'))->set($db->qn('position') . '=' . $db->q($modulePosition));
if ($modulePublished) {
$query->set($db->qn('published') . '=' . $db->q(1));
}
$query->set($db->qn('params') . '=' . $db->q($installer->getParams()));
$query->where($db->qn('module') . '=' . $db->q($module));
$db->setQuery($query);
$db->execute();
}
// Get module id
$query->clear();
$query->select('id')->from($db->qn('#__modules'))->where($db->qn('module') . '=' . $db->q($module));
$db->setQuery($query);
$moduleId = $db->loadObject()->id;
$query->clear();
$query->select('COUNT(*) as count')->from($db->qn('#__modules_menu'))->where($db->qn('moduleid') . '=' . $db->q($moduleId));
$db->setQuery($query);
if (!$db->loadObject()->count) {
// Insert the module on all pages, otherwise we can't use it
$query->clear();
$query->insert($db->qn('#__modules_menu'))->columns($db->qn('moduleid') . ',' . $db->qn('menuid'))->values($db->q($moduleId) . ' , ' . $db->q('0'));
$db->setQuery($query);
$db->execute();
}
}
}
}
}
return $status;
}
示例2: installModules
/**
* Installs the modules
*
* @return void
*/
private function installModules()
{
$src = $this->parent->getParent()->getPath('source');
// Modules installation
if (count($this->installationQueue['modules'])) {
foreach ($this->installationQueue['modules'] as $folder => $modules) {
if (count($modules)) {
foreach ($modules as $module => $modulePreferences) {
// Install the module
if (empty($folder)) {
$folder = 'site';
}
$path = "{$src}/modules/{$module}";
if ($folder == 'admin') {
$path = "{$src}/administrator/modules/{$module}";
}
if (!is_dir($path)) {
continue;
}
$db = JFactory::getDbo();
// Was the module alrady installed?
$sql = 'SELECT COUNT(*) FROM #__modules WHERE `module`=' . $db->Quote($module);
$db->setQuery($sql);
$count = $db->loadResult();
$installer = new JInstaller();
$result = $installer->install($path);
$this->status->modules[] = array('name' => $module, 'client' => $folder, 'result' => $result);
// Modify where it's published and its published state
if (!$count) {
list($modulePosition, $modulePublished) = $modulePreferences;
$sql = "UPDATE #__modules SET position=" . $db->Quote($modulePosition);
if ($modulePublished) {
$sql .= ', published=1';
}
$sql .= ', params = ' . $db->quote($installer->getParams());
$sql .= ' WHERE `module`=' . $db->Quote($module);
$db->setQuery($sql);
$db->execute();
// Get module id
$db->setQuery('SELECT id FROM #__modules WHERE module = ' . $db->quote($module));
$moduleId = $db->loadObject()->id;
// Insert the module on all pages, otherwise we can't use it
$query = 'INSERT INTO #__modules_menu(moduleid, menuid) VALUES (' . $db->quote($moduleId) . ' ,0 );';
$db->setQuery($query);
$db->execute();
}
}
}
}
}
}