本文整理汇总了PHP中JInstallerHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JInstallerHelper类的具体用法?PHP JInstallerHelper怎么用?PHP JInstallerHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JInstallerHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: install
public function install(InputInterface $input, OutputInterface $output)
{
$app = Bootstrapper::getApplication($this->target_dir);
// Output buffer is used as a guard against Joomla including ._ files when searching for adapters
// See: http://kadin.sdf-us.org/weblog/technology/software/deleting-dot-underscore-files.html
ob_start();
$installer = $app->getInstaller();
foreach ($this->extension as $package) {
$remove = false;
if (is_file($package)) {
$result = \JInstallerHelper::unpack($package);
$directory = isset($result['dir']) ? $result['dir'] : false;
$remove = true;
} else {
$directory = $package;
}
if ($directory !== false) {
$path = realpath($directory);
if (!file_exists($path)) {
$output->writeln("<info>File not found: " . $directory . "</info>\n");
continue;
}
try {
$installer->install($path);
} catch (\Exception $e) {
$output->writeln("<info>Caught exception during install: " . $e->getMessage() . "</info>\n");
}
if ($remove) {
\JFolder::delete($path);
}
}
}
ob_end_clean();
}
开发者ID:eitamar,项目名称:joomlatools-console,代码行数:34,代码来源:InstallFile.php
示例2: getPackageFromUpload
function getPackageFromUpload()
{
$install_file = JRequest::getVar('package', null, 'files', 'array');
if (!(bool) ini_get('file_uploads')) {
$msg = 'File upload function is disabled, please enable it in file "php.ini"';
JError::raiseWarning('SOME_ERROR_CODE', JText::_($msg));
return false;
}
if (!extension_loaded('zlib')) {
$msg = 'Zlib library is disabled, please enable it in file "php.ini"';
JError::raiseWarning('SOME_ERROR_CODE', JText::_($msg));
return false;
}
if ($install_file['name'] == '') {
$msg = 'The package is not selected, please download and select it';
JError::raiseWarning('SOME_ERROR_CODE', JText::_($msg));
return false;
}
if (JFile::getExt($install_file['name']) != 'zip') {
$msg = 'The package has incorrect format, please use exactly the file you downloaded';
JError::raiseWarning('SOME_ERROR_CODE', JText::_($msg));
return false;
}
$tmp_dest = JPATH_ROOT . DS . 'tmp' . DS . $install_file['name'];
$tmp_src = $install_file['tmp_name'];
if (!JFile::upload($tmp_src, $tmp_dest)) {
$msg = 'Folder "tmp" is Unwritable, please set it to Writable (chmod 777). You can set the folder back to Unwritable after sample data installation';
JError::raiseWarning('SOME_ERROR_CODE', JText::_($msg));
return false;
}
$package = JInstallerHelper::unpack($tmp_dest);
return $package;
}
开发者ID:Rikisha,项目名称:proj,代码行数:33,代码来源:jsn_manual_updater_helper.php
示例3: installGiantExtensionsPlugin
private function installGiantExtensionsPlugin()
{
$pluginPath = dirname(__FILE__) . '/plg_content_giantcontent.zip';
$installResult = JInstallerHelper::unpack($pluginPath);
if (empty($installResult)) {
$app = JFactory::getApplication();
$app->enqueueMessage('Giant Content can not install "Content - Giant Content" plugin. Please install plugin manually inside package.', 'error');
return false;
}
$installer = new JInstaller();
$installer->setOverwrite(true);
if (!$installer->install($installResult['extractdir'])) {
$app = JFactory::getApplication();
$app->enqueueMessage('Giant Content can not install "Content - Giant Content" plugin. Please install plugin manually inside package.', 'error');
return false;
}
$db = JFactory::getDBO();
$db->setQuery('UPDATE #__extensions SET enabled = 1 WHERE type = "plugin" AND folder = "content" AND element = "giantcontent"');
$db->query();
if ($db->getErrorNum()) {
$app = JFactory::getApplication();
$app->enqueueMessage('Giant Content can not enable "Content - Giant Content" plugin. Please enable plugin manually in the plugin manager.', 'warning');
}
return true;
}
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:25,代码来源:install.php
示例4: runSQL
protected function runSQL($source, $file)
{
$db = JFactory::getDbo();
$driver = strtolower($db->name);
if ($driver == 'mysqli') {
$driver = 'mysql';
} elseif ($driver == 'sqlsrv') {
$driver = 'sqlazure';
}
$sqlfile = $source . '/sql/' . $driver . '/' . $file;
if (file_exists($sqlfile)) {
$buffer = file_get_contents($sqlfile);
if ($buffer !== false) {
$queries = JInstallerHelper::splitSql($buffer);
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->execute()) {
JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
}
}
}
}
}
}
开发者ID:knigherrant,项目名称:decopatio,代码行数:26,代码来源:script.php
示例5: querySQL
function querySQL($buffer)
{
$db =& JFactory::getDBO();
// Graceful exit and rollback if read not successful
if ($buffer === false) {
return false;
}
// Create an array of queries from the sql file
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) == 0) {
// No queries to process
return 0;
}
// Process each query in the $queries array (split out of sql file).
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->query()) {
JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $db->stderr(true));
return false;
}
}
}
return true;
}
开发者ID:ManniManfred,项目名称:JoomlaFussballManager,代码行数:27,代码来源:install.php
示例6: update
function update($parent)
{
$db = JFactory::getDBO();
if (method_exists($parent, 'extension_root')) {
$sqlfile = $parent->getPath('extension_root') . DS . 'sql' . DS . 'install.mysql.utf8.sql';
} else {
$sqlfile = $parent->getParent()->getPath('extension_root') . DS . 'sql' . DS . 'install.mysql.utf8.sql';
}
// Don't modify below this line
$buffer = file_get_contents($sqlfile);
if ($buffer !== false) {
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) != 0) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->query()) {
CJFunctions::throw_error(JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)), 1);
return false;
}
}
}
}
}
echo '<p>' . JText::sprintf('COM_CJBLOG_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
}
开发者ID:Ruud68,项目名称:cjblog,代码行数:28,代码来源:script.php
示例7: postflight
function postflight($type, $parent)
{
if ($type == 'update') {
$sqlfile = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsform' . DS . 'install.rsform.utf8.sql';
$buffer = file_get_contents($sqlfile);
if ($buffer === false) {
JError::raiseWarning(1, JText::_('JLIB_INSTALLER_ERROR_SQL_READBUFFER'));
return false;
}
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) == 0) {
// No queries to process
return 0;
}
$db =& JFactory::getDBO();
// Process each query in the $queries array (split out of sql file).
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->query()) {
JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
return false;
}
}
}
}
}
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:29,代码来源:script.rsform.php
示例8: install
/**
* Download and install
*/
function install($id, $url)
{
if (!is_string($url)) {
return JText::_('NNEM_ERROR_NO_VALID_URL');
}
$url = 'http://' . str_replace('http://', '', $url);
if (!($target = JInstallerHelper::downloadPackage($url))) {
return JText::_('NNEM_ERROR_CANNOT_DOWNLOAD_FILE');
}
$target = JFactory::getConfig()->get('tmp_path') . '/' . $target;
NNFrameworkFunctions::loadLanguage('com_installer', JPATH_ADMINISTRATOR);
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
// Get an installer instance
$installer = JInstaller::getInstance();
// Unpack the package
$package = JInstallerHelper::unpack($target);
// Cleanup the install files
if (!is_file($package['packagefile'])) {
$config = JFactory::getConfig();
$package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
}
JInstallerHelper::cleanupInstall($package['packagefile'], $package['packagefile']);
// Install the package
if (!$installer->install($package['dir'])) {
// There was an error installing the package
return JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
}
return true;
}
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:33,代码来源:process.php
示例9: installPluginTableByThemeName
function installPluginTableByThemeName($themeName)
{
jimport('joomla.filesystem.file');
$sqlFile = JPATH_PLUGINS . DS . $this->_pluginType . DS . $themeName . DS . $this->_installFile;
if (JFile::exists($sqlFile)) {
$objJNSUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$buffer = $objJNSUtils->readFileToString($sqlFile);
if ($buffer === false) {
return false;
}
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) == 0) {
JError::raiseWarning(100, $sqlFile . JText::_(' not exits'));
return 0;
}
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$this->_db->setQuery($query);
if (!$this->_db->query()) {
JError::raiseWarning(100, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $this->_db->stderr(true));
return false;
}
}
}
return true;
} else {
JError::raiseWarning(100, $sqlFile . JText::_(' not exits'));
return false;
}
}
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:32,代码来源:jsn_is_showcasetheme.php
示例10: update
function update($parent)
{
$db = JFactory::getDBO();
if (method_exists($parent, 'extension_root')) {
$sqlfile = $parent->getPath('extension_root') . DS . 'sql' . DS . 'install.mysql.utf8.sql';
} else {
$sqlfile = $parent->getParent()->getPath('extension_root') . DS . 'sql' . DS . 'install.mysql.utf8.sql';
}
// Don't modify below this line
$buffer = file_get_contents($sqlfile);
if ($buffer !== false) {
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) != 0) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->query()) {
JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
return false;
}
}
}
}
}
echo '<p>' . JText::_('COM_COMMUNITYSURVEYS_UPDATE_TEXT') . '</p>';
$parent->getParent()->setRedirectURL('index.php?option=com_communitysurveys&view=dashboard');
}
开发者ID:pguilford,项目名称:vcomcc,代码行数:29,代码来源:script.php
示例11: update
function update($parent)
{
$db = JFactory::getDBO();
if (method_exists($parent, 'extension_root')) {
$sqlfile = $parent->getPath('extension_root') . '/sql/install.mysql.sql';
} else {
$sqlfile = $parent->getParent()->getPath('extension_root') . '/sql/install.mysql.sql';
}
// Don't modify below this line
$buffer = file_get_contents($sqlfile);
if ($buffer !== false) {
jimport('joomla.installer.helper');
$queries = JInstallerHelper::splitSql($buffer);
if (count($queries) != 0) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->query()) {
JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
return false;
}
}
}
}
}
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:27,代码来源:script.jacc.php
示例12: _installPackage
function _installPackage()
{
$installer = JSNISInstaller::getInstance();
if ($this->_packageExtract) {
$objJSNPlugins = JSNISFactory::getObj('classes.jsn_is_plugins');
$countSource = count($this->_listCurrentSources);
$currentSources = array();
if ($countSource) {
for ($i = 0; $i < $countSource; $i++) {
$item = $this->_listCurrentSources[$i];
$currentSources[$item->element] = $objJSNPlugins->getXmlFile($item);
}
}
if (!$installer->install($this->_packageExtract['dir'])) {
$this->_msgError = JText::_('INSTALLER_IMAGE_SOURCE_PACKAGE_UNSUCCESSFULLY_INSTALLED');
$this->_error = true;
return false;
}
$this->_upgradeSourceDB($currentSources, $installer);
if (!is_file($this->_packageExtract['packagefile'])) {
$config = JFactory::getConfig();
$package['packagefile'] = $config->getValue('config.tmp_path') . DS . $this->_packageExtract['packagefile'];
}
JInstallerHelper::cleanupInstall($this->_packageExtract['packagefile'], $this->_packageExtract['extractdir']);
}
}
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:26,代码来源:jsn_is_installimagesource.php
示例13: postflight
function postflight($type, $parent)
{
if (version_compare(JVERSION, '3.0.0', '>')) {
$messages = array();
// Import required modules
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
jimport('joomla.filesystem.file');
//$db = JFactory::getDBO();
//$query = "ALTER TABLE #__k2_items ADD FULLTEXT(extra_fields)";
//$db->setQuery($query);
//$db->query();
// Get packages
$p_dir = JPath::clean(JPATH_SITE . DS . 'components' . DS . 'com_jak2filter' . DS . 'packages');
// Did you give us a valid directory?
if (!is_dir($p_dir)) {
$messages[] = JText::_('Package directory(Related modules, plugins) is missing');
} else {
$subpackages = JFolder::files($p_dir);
$result = true;
$installer = new JInstaller();
if ($subpackages) {
$app = JFactory::getApplication();
$templateDir = 'templates/' . $app->getTemplate();
foreach ($subpackages as $zpackage) {
if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
continue;
}
$subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
if ($subpackage) {
$type = JInstallerHelper::detectType($subpackage['dir']);
if (!$type) {
$messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" /> <span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
$result = false;
}
if (!$installer->install($subpackage['dir'])) {
// There was an error installing the package
$messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" /> <span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
} else {
$messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" /> <span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
}
if (!is_file($subpackage['packagefile'])) {
$subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
}
if (is_dir($subpackage['extractdir'])) {
JFolder::delete($subpackage['extractdir']);
}
if (is_file($subpackage['packagefile'])) {
JFile::delete($subpackage['packagefile']);
}
}
}
}
JFolder::delete($p_dir);
}
}
}
开发者ID:jamielaff,项目名称:als_resourcing,代码行数:57,代码来源:script.jak2filter.php
示例14: update
public function update()
{
// Make sure there are updates available
$updates = $this->getModel('update')->getUpdates(false);
if (!$updates->update_available) {
$this->app->enqueueMessage(JText::_('JM_ERR_UPDATE_NOUPDATES'), 'error');
$this->app->redirect(JURI::base() . 'index.php?option=com_joomailermailchimpintegration');
}
// Download the package
$config = JFactory::getConfig();
$target = $config->get('tmp_path') . '/joomailermailchimpintegration_update.zip';
$result = $this->getModel('update')->downloadPackage($updates->packageUrl, $target);
if ($result === false) {
$this->app->enqueueMessage(JText::_('JM_ERR_UPDATE_CANTDOWNLOAD'), 'error');
$this->app->redirect(JURI::base() . 'index.php?option=com_joomailermailchimpintegration');
}
// Extract the package
jimport('joomla.installer.helper');
$result = JInstallerHelper::unpack($target);
if ($result === false) {
$this->app->enqueueMessage(JText::_('JM_ERR_UPDATE_CANTEXTRACT'), 'error');
$this->app->redirect(JURI::base() . 'index.php?option=com_joomailermailchimpintegration');
}
// Package extracted; run the installer
$tempdir = $result['dir'];
@ob_end_clean();
?>
<html>
<head></head>
<body>
<form action="<?php
echo JURI::base() . 'index.php?option=com_installer&view=install';
?>
" method="post" name="frm" id="frm">
<input type="hidden" name="task" value="install.install" />
<input type="hidden" name="installtype" value="folder" />
<input type="hidden" name="install_directory" value="<?php
echo htmlspecialchars($tempdir);
?>
" />
<input type="hidden" name="<?php
echo JSession::getFormToken();
?>
" value="1" />
</form>
<script type="text/javascript">
document.frm.submit();
</script>
</body>
<html><?php
exit;
}
开发者ID:rodhoff,项目名称:MNW,代码行数:52,代码来源:update.php
示例15: install
/**
* method to install the component
*
* @return void
* <div id="system-message-container">
<div id="system-message">
<div class="alert alert-message"><a class="close" data-dismiss="alert">×</a>
<h4 class="alert-heading">Message</h4>
<div>
<p>Installing component was successful.</p>
</div>
</div>
</div>
</div>
*/
function install($parent)
{
// $parent is the class calling this method
echo '<div id="system-message-container">';
$msgtext = "";
echo '<div id="system-message">
<div style=" overflow:hidden; margin:8px 0 8px 0; padding:5px;" >
<div style=" font-size:12px; margin:0px 0 0px 0; padding:5px; position:relative; float:right;"><div>Powered by Percha.com</div></div>
<div style="float:left; margin:0 20px 20px 0;"><img src="http://www.fieldsattach.com/images/logo_fieldsattach_small.png" alt="fieldsattach.com" /></div>
<div style=" margin:30px 0 8px 0; padding:5px; font-size:23px; color:#4892AB;">Thanks for install the Fieldsattach component.</div>
</div>';
//INSTALL THE PLUGINS *******************************************************************************
$installer = new JInstaller();
//$installer->_overwrite = true;
$pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_fieldsattach' . DS . 'extensions' . DS;
$pkgs = array('input.zip' => 'Plugin fieldsattachment <strong>Input</strong>', 'file.zip' => 'Plugin fieldsattachment <strong>File</strong>', 'image.zip' => 'Plugin fieldsattachment <strong>image</strong>', 'imagegallery.zip' => 'Plugin fieldsattachment <strong>imagegallery</strong>', 'select.zip' => 'Plugin fieldsattachment <strong>select</strong>', 'textarea.zip' => 'Plugin fieldsattachment <strong>textarea</strong>', 'content_fieldsattachment.zip' => 'Plugin Content FieldsAttachment', 'system_fieldsattachment.zip' => 'Plugin System FieldsAttachment', 'advancedsearch_fieldsattachment.zip' => 'Plugin Advanced Search FieldsAttachment', 'filterarticles.zip' => 'Plugin Advanced FILTER FieldsAttachment');
foreach ($pkgs as $pkg => $pkgname) {
$package = JInstallerHelper::unpack($pkg_path . $pkg);
if ($installer->install($package['dir'])) {
$msgtext .= '<div id="system-message-container"><div class="alert alert-message">' . $pkgname . ' successfully installed.</div></div>';
//ACTIVE IT
} else {
$msgtext .= '<div id="system-message-container"><div class="alert alert-message">ERROR: Could not install the $pkgname. Please install manually</div></div>';
}
//ACTIVE THE PLUGINS *******************************************************************************
$db = JFactory::getDBO();
$sql = "UPDATE #__extensions SET enabled = 1 WHERE element = 'fieldsattachment'";
$db->setQuery($sql);
$db->query();
$db = JFactory::getDBO();
$sql = "UPDATE #__extensions SET enabled = 1 WHERE element = 'fieldsattachmentadvanced'";
$db->setQuery($sql);
$db->query();
$db = JFactory::getDBO();
$sql = "UPDATE #__extensions SET enabled = 1 WHERE folder = 'fieldsattachment'";
$db->setQuery($sql);
$db->query();
//DESACTIVE OLD SEARCH
$db = JFactory::getDBO();
$sql = "UPDATE #__extensions SET enabled = 0 WHERE element = 'fieldsattachment' AND folder='search'";
$db->setQuery($sql);
$db->query();
JInstallerHelper::cleanupInstall($pkg_path . $pkg, $package['dir']);
}
//DELETE EXTENSIONS
$pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_fieldsattach' . DS . 'extensions' . DS;
destroy_dir($pkg_path);
$msgtext .= '<div id="system-message-container"><div class="alert alert-message">Clean install directory: ' . $pkg_path . '</div></div>';
echo $msgtext;
echo '</div>';
//$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');
}
开发者ID:adjaika,项目名称:J3Base,代码行数:67,代码来源:install.php
示例16: com_install
function com_install()
{
JAVoiceHelpers::Install_Db();
$messages = array();
// Import required modules
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
jimport('joomla.filesystem.file');
// Get packages
$p_dir = JPath::clean(JPATH_SITE . '/components/com_javoice/packages');
// Did you give us a valid directory?
if (!is_dir($p_dir)) {
$messages[] = JText::_('Package directory(Related modules, plugins) is missing');
} else {
$subpackages = JFolder::files($p_dir);
$result = true;
$installer = new JInstaller();
if ($subpackages) {
$app = JFactory::getApplication();
$templateDir = 'templates/' . $app->getTemplate();
foreach ($subpackages as $zpackage) {
if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
continue;
}
$subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
if ($subpackage) {
$type = JInstallerHelper::detectType($subpackage['dir']);
if (!$type) {
$messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" /> <span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
$result = false;
}
if (!$installer->install($subpackage['dir'])) {
// There was an error installing the package
$messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" /> <span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
} else {
$messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" /> <span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
}
if (!is_file($subpackage['packagefile'])) {
$subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
}
if (is_dir($subpackage['extractdir'])) {
JFolder::delete($subpackage['extractdir']);
}
if (is_file($subpackage['packagefile'])) {
JFile::delete($subpackage['packagefile']);
}
}
}
}
JFolder::delete($p_dir);
}
}
开发者ID:jomsocial,项目名称:JSVoice,代码行数:52,代码来源:install.javoice.php
示例17: applyDump
public function applyDump($dump)
{
jimport("joomla.installer.helper");
jimport("joomla.version");
$version = new JVersion();
if ($version->RELEASE == "1.5") {
$helper = new JInstallerHelper();
$sql_statements = $helper->splitSql($dump);
} else {
//$helper = new JInstallerHelper();
$sql_statements = JInstallerHelper::splitSql($dump);
}
$db =& JFactory::getDBO();
$count = 0;
foreach ($sql_statements as $statement) {
if (trim($statement)) {
$db->setQuery($statement);
$db->query();
$count++;
}
}
return $count;
}
开发者ID:Rikisha,项目名称:proj,代码行数:23,代码来源:backups.php
示例18: _getPackageFromDistributives
private function _getPackageFromDistributives($plugin_distr)
{
// Make sure that zlib is loaded so that the package can be unpacked
if (!extension_loaded('zlib')) {
return false;
}
//Check file exist
if (!file_exists($plugin_distr)) {
return false;
}
// Unpack the downloaded package file
$package = JInstallerHelper::unpack($plugin_distr);
return $package;
}
开发者ID:jvhost,项目名称:A-Website,代码行数:14,代码来源:install_package_cli.php
示例19: autoupdate
function autoupdate()
{
$update = $this->parseXMLFile();
$config =& JFactory::getConfig();
$tmp_dest = $config->getValue('config.tmp_path');
if (!is_object($update)) {
// parseXMLFile will have set a message hopefully
//$this->setState('message', 'XML Parse failed');
return false;
} else {
$destination = $tmp_dest . DS . 'com_jupdateman_auto.tgz';
$download = downloadFile($update->updaterurl, $destination);
if ($download !== true) {
$this->setState('message', $download->error_message);
return false;
} else {
$package = JInstallerHelper::unpack($destination);
if (!$package) {
$this->setState('message', 'Unable to find install package');
return false;
}
$installer =& JInstaller::getInstance();
// Install the package
if (!$installer->install($package['dir'])) {
// There was an error installing the package
$msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Error'));
$result = false;
} else {
// Package installed sucessfully
$msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Success'));
$result = true;
}
// Grab the application
$mainframe =& JFactory::getApplication();
// Set some model state values
$mainframe->enqueueMessage($msg);
$this->setState('name', $installer->get('name'));
$this->setState('result', $result);
$this->setState('message', $installer->message);
$this->setState('extension.message', $installer->get('extension.message'));
// Cleanup the install files
if (!is_file($package['packagefile'])) {
$config =& JFactory::getConfig();
$package['packagefile'] = $config->getValue('config.tmp_path') . DS . $package['packagefile'];
}
JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
return $result;
}
}
}
开发者ID:planetangel,项目名称:Planet-Angel-Website,代码行数:50,代码来源:jupdateman.php
示例20: postflight
function postflight($type, $parent)
{
$url = "http://www.jhackguard.com/downloads/com_jhackguard.zip";
// Download the package at the URL given
$p_file = JInstallerHelper::downloadPackage($url);
// Was the package downloaded?
if (!$p_file) {
JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'));
return false;
}
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
// Unpack the downloaded package file
$package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file, true);
// Was the package unpacked?
if (!$package || !$package['type']) {
if (in_array($installType, array('upload', 'url'))) {
JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
}
$app->setUserState('com_installer.message', JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'));
return false;
}
// Get an installer instance
$installer = new JInstaller();
// Install the package
if (!$installer->install($package['dir'])) {
// There was an error installing the package
$msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
$result = false;
} else {
// Package installed sucessfully
$msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
$result = true;
}
// Set some model state values
$app = JFactory::getApplication();
$app->enqueueMessage($msg);
$app->setUserState('com_installer.message', $installer->message);
$app->setUserState('com_installer.extension_message', $installer->get('extension_message'));
$app->setUserState('com_installer.redirect_url', $installer->get('redirect_url'));
// Cleanup the install files
if (!is_file($package['packagefile'])) {
$config = JFactory::getConfig();
$package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
}
JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
$app->enqueueMessage("The default installation of jHackGuard has no filters included. Please download the latest filters by going to the '<b>Filter Maintenance</b>' page in the component menu.", "error");
}
开发者ID:ejailesb,项目名称:repo_empr,代码行数:48,代码来源:installer.php
注:本文中的JInstallerHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论