本文整理汇总了PHP中JUpdate类的典型用法代码示例。如果您正苦于以下问题:PHP JUpdate类的具体用法?PHP JUpdate怎么用?PHP JUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JUpdate类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
public function update($uids)
{
$result = true;
foreach ($uids as $uid) {
$update = new JUpdate();
$instance = JTable::getInstance('update');
$instance->load($uid);
$update->loadFromXML($instance->detailsurl);
$update->set('extra_query', $instance->extra_query);
// Install sets state and enqueues messages
$res = $this->install($update);
if ($res) {
$instance->delete($uid);
}
$result = $res & $result;
}
// Set the final state
$this->setState('result', $result);
}
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:19,代码来源:updates.php
示例2: getInstallFrom
private function getInstallFrom()
{
if (is_null($this->_installfrom)) {
$app = JFactory::getApplication();
$installfrom = base64_decode($app->input->get('installfrom', '', 'base64'));
$field = new SimpleXMLElement('<field></field>');
$rule = new JFormRuleUrl();
if ($rule->test($field, $installfrom) && preg_match('/\\.xml\\s*$/', $installfrom)) {
jimport('joomla.updater.update');
$update = new JUpdate();
$update->loadFromXML($installfrom);
$package_url = trim($update->get('downloadurl', false)->_data);
if ($package_url) {
$installfrom = $package_url;
}
}
$this->_installfrom = $installfrom;
}
return $this->_installfrom;
}
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:20,代码来源:jainstaller.php
示例3: update
public function update($id)
{
$updaterow =& JTable::getInstance('update');
$updaterow->load($id);
$update = new JUpdate();
if ($update->loadFromXML($updaterow->detailsurl)) {
return $update->install();
}
return false;
}
开发者ID:joebushi,项目名称:joomla,代码行数:10,代码来源:updater.php
示例4: install
/**
* Handles the actual update installation.
*
* @param JUpdate $update An update definition
*
* @return boolean Result of install
*
* @since 1.6
*/
private function install($update)
{
$app = JFactory::getApplication();
if (isset($update->get('downloadurl')->_data)) {
$url = $update->downloadurl->_data;
$extra_query = $update->get('extra_query');
if ($extra_query) {
if (strpos($url, '?') === false) {
$url .= '?';
} else {
$url .= '&';
}
$url .= $extra_query;
}
} else {
JError::raiseWarning('', JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE'));
return false;
}
$p_file = JInstallerHelper::downloadPackage($url);
// Was the package downloaded?
if (!$p_file) {
JError::raiseWarning('', JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url));
return false;
}
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
// Unpack the downloaded package file
$package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
// Get an installer instance
$installer = JInstaller::getInstance();
$update->set('type', $package['type']);
// Install the package
if (!$installer->update($package['dir'])) {
// There was an error updating the package
$msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
$result = false;
} else {
// Package updated successfully
$msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
$result = true;
}
// Quick change
$this->type = $package['type'];
// Set some model state values
$app->enqueueMessage($msg);
// TODO: Reconfigure this code when you have more battery life left
$this->setState('name', $installer->get('name'));
$this->setState('result', $result);
$app->setUserState('com_installer.message', $installer->message);
$app->setUserState('com_installer.extension_message', $installer->get('extension_message'));
// 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']);
return $result;
}
开发者ID:Rajiii4u,项目名称:joomla-cms,代码行数:67,代码来源:update.php
示例5: getUpdateInformation
/**
* Returns an array with the Joomla! update information.
*
* @return array
*
* @since 2.5.4
*/
public function getUpdateInformation()
{
// Initialise the return array.
$ret = array('installed' => JVERSION, 'latest' => null, 'object' => null, 'hasUpdate' => false);
// Fetch the update information from the database.
$db = $this->getDbo();
$query = $db->getQuery(true)->select('*')->from($db->quoteName('#__updates'))->where($db->quoteName('extension_id') . ' = ' . $db->quote(700));
$db->setQuery($query);
$updateObject = $db->loadObject();
if (is_null($updateObject)) {
$ret['latest'] = JVERSION;
return $ret;
}
$ret['latest'] = $updateObject->version;
$ret['hasUpdate'] = $updateObject->version != JVERSION;
// Fetch the full update details from the update details URL.
jimport('joomla.updater.update');
$update = new JUpdate();
$update->loadFromXML($updateObject->detailsurl);
$ret['object'] = $update;
return $ret;
}
开发者ID:adjaika,项目名称:J3Base,代码行数:29,代码来源:default.php
示例6: findUpdatesJoomla
/**
* Find the available update record object. If we're at the latest version it will return null.
*
* @param bool $force Should I forcibly reload the updates from the server?
*
* @return \stdClass|null
*/
protected function findUpdatesJoomla($force = false)
{
$db = F0FPlatform::getInstance()->getDbo();
// If we are forcing the reload, set the last_check_timestamp to 0
// and remove cached component update info in order to force a reload
if ($force) {
// Find the update site IDs
$updateSiteIds = $this->getUpdateSiteIds();
if (empty($updateSiteIds)) {
return null;
}
// Set the last_check_timestamp to 0
if (version_compare(JVERSION, '2.5.0', 'ge')) {
$query = $db->getQuery(true)->update($db->qn('#__update_sites'))->set($db->qn('last_check_timestamp') . ' = ' . $db->q('0'))->where($db->qn('update_site_id') . ' IN (' . implode(', ', $updateSiteIds) . ')');
$db->setQuery($query);
$db->execute();
}
// Remove cached component update info from #__updates
$query = $db->getQuery(true)->delete($db->qn('#__updates'))->where($db->qn('update_site_id') . ' IN (' . implode(', ', $updateSiteIds) . ')');
$db->setQuery($query);
$db->execute();
}
// Use the update cache timeout specified in com_installer
$timeout = 3600 * F0FUtilsConfigHelper::getComponentConfigurationValue('com_installer', 'cachetimeout', '6');
// Load any updates from the network into the #__updates table
$this->updater->findUpdates($this->extension_id, $timeout);
// Get the update record from the database
$query = $db->getQuery(true)->select('*')->from($db->qn('#__updates'))->where($db->qn('extension_id') . ' = ' . $db->q($this->extension_id));
$db->setQuery($query);
try {
$updateObject = $db->loadObject();
} catch (Exception $e) {
return null;
}
if (!is_object($updateObject)) {
return null;
}
$updateObject->downloadurl = '';
JLoader::import('joomla.updater.update');
if (class_exists('JUpdate')) {
$update = new JUpdate();
$update->loadFromXML($updateObject->detailsurl);
if (isset($update->get('downloadurl')->_data)) {
$url = trim($update->downloadurl->_data);
$extra_query = isset($updateObject->extra_query) ? $updateObject->extra_query : $this->extraQuery;
if ($extra_query) {
if (strpos($url, '?') === false) {
$url .= '?';
} else {
$url .= '&';
}
$url .= $extra_query;
}
$updateObject->downloadurl = $url;
}
}
return $updateObject;
}
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:65,代码来源:update.php
示例7: update
/**
* Update function.
*
* Sets the "result" state with the result of the operation.
*
* @param Array[int] List of updates to apply
* @since 1.6
*/
public function update($uids)
{
$result = true;
foreach ($uids as $uid) {
$update = new JUpdate();
$instance = JTable::getInstance('update');
$instance->load($uid);
$update->loadFromXML($instance->detailsurl);
// install sets state and enqueues messages
$res = $this->install($update);
// Disabling the purging of the update list, instead deleting specific row
if ($res) {
$instance->delete($uid);
}
$result = $res & $result;
}
// Set the final state
$this->setState('result', $result);
}
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:27,代码来源:update.php
示例8: downloadUpdate
/**
* Downloads an update package given an update record ID ($uid). The package is downloaded
* and its location recorded in the session.
*
* @param integer $uid The update record ID
*
* @return True on success
*/
public function downloadUpdate($uid)
{
// Unset the compressed_package session variable
$session = JFactory::getSession();
$session->set('compressed_package', null, 'akeeba');
// Find the download location from the XML update stream
jimport('joomla.updater.update');
$update = new JUpdate();
$instance = JTable::getInstance('update');
$instance->load($uid);
$update->loadFromXML($instance->detailsurl);
if (isset($update->get('downloadurl')->_data)) {
$url = $update->downloadurl->_data;
} else {
JError::raiseWarning('', JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE'));
return false;
}
// Download the package
$p_file = JInstallerHelper::downloadPackage($url);
// Was the package downloaded?
if (!$p_file) {
JError::raiseWarning('', JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url));
return false;
}
// Store the uploaded package's location
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
$session->set('compressed_package', $tmp_dest . '/' . $p_file, 'akeeba');
return true;
}
开发者ID:sillysachin,项目名称:teamtogether,代码行数:38,代码来源:installer.php
示例9: getExtension
public function getExtension()
{
// Get extension id
$cache = JFactory::getCache();
$cache->setCaching(1);
$http = new JHttp();
$http->setOption('timeout', 60);
$api_url = new JUri();
$input = new JInput();
$id = $input->get('id', null, 'int');
$release = preg_replace('/[^\\d]/', '', base64_decode($input->get('release', '', 'base64')));
$release = intval($release / 5) * 5;
$api_url->setScheme('http');
$api_url->setHost('extensions.joomla.org/index.php');
$api_url->setvar('option', 'com_jed');
$api_url->setvar('controller', 'filter');
$api_url->setvar('view', 'extension');
$api_url->setvar('format', 'json');
$api_url->setvar('filter[approved]', '1');
$api_url->setvar('filter[published]', '1');
$api_url->setvar('extend', '0');
$api_url->setvar('filter[id]', $id);
$extension_json = $cache->call(array($http, 'get'), $api_url);
// Create item
$items = json_decode($extension_json->body);
$item = $items->data[0];
$this->_catid = $item->core_catid->value;
$item->image = $this->getBaseModel()->getMainImageUrl($item);
$item->downloadurl = $item->download_integration_url->value;
if (preg_match('/\\.xml\\s*$/', $item->downloadurl)) {
$app = JFactory::getApplication();
$product = addslashes(base64_decode($app->input->get('product', '', 'base64')));
$release = preg_replace('/[^\\d\\.]/', '', base64_decode($app->input->get('release', '', 'base64')));
$dev_level = (int) base64_decode($app->input->get('dev_level', '', 'base64'));
$updatefile = JPATH_ROOT . '/libraries/joomla/updater/update.php';
$fh = fopen($updatefile, 'r');
$theData = fread($fh, filesize($updatefile));
fclose($fh);
$theData = str_replace('<?php', '', $theData);
$theData = str_replace('$ver->PRODUCT', "'" . $product . "'", $theData);
$theData = str_replace('$ver->RELEASE', "'" . $release . "'", $theData);
$theData = str_replace('$ver->DEV_LEVEL', "'" . $dev_level . "'", $theData);
eval($theData);
$update = new JUpdate();
$update->loadFromXML($item->downloadurl);
$package_url_node = $update->get('downloadurl', false);
if (isset($package_url_node->_data)) {
$item->downloadurl = $package_url_node->_data;
}
}
$item->download_type = $this->getTypeEnum($item->download_integration_type->value);
return array($item);
}
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:53,代码来源:extension.php
示例10: distro_download
/**
* Square One Additions
*/
public function distro_download()
{
$update = new JUpdate();
$detailsurl = base64_decode(JRequest::getString('detailsurl', '', 'post'));
if (substr($detailsurl, 0, 4) == 'http') {
$result->result = false;
if (substr($detailsurl, 0, -3) == 'xml') {
// Url to an update manifest
$update->loadFromXML($detailsurl);
$file = JInstallerHelper::downloadPackage($update->get('downloadurl')->_data);
} else {
$file = JInstallerHelper::downloadPackage($detailsurl);
}
if (!$file) {
$result->message = JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL');
} else {
$result->result = true;
$result->task = 'distro_download';
$result->file = $file;
$result->message = JText::_('COM_INSTALLER_PACKAGE_DOWNLOADED');
}
} else {
// We have a file
$config = JFactory::getConfig();
$source = base64_decode(JRequest::getString('source'));
JFile::move($source . '/' . $detailsurl, $config->get('tmp_path') . '/' . $detailsurl);
$result->result = true;
$result->task = 'distro_download';
$result->file = $detailsurl;
$result->message = JText::_('COM_INSTALLER_PACKAGE_FOUND');
}
return $result;
}
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:36,代码来源:oneclick.php
示例11: _getPackageFromUrl
/**
* Install an extension from a URL.
*
* @return Package details or false on failure.
*
* @since 1.5
*/
protected function _getPackageFromUrl()
{
$input = JFactory::getApplication()->input;
// Get the URL of the package to install.
$url = $input->getString('install_url');
// Did you give us a URL?
if (!$url) {
JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL'));
return false;
}
// Handle updater XML file case:
if (preg_match('/\\.xml\\s*$/', $url)) {
jimport('joomla.updater.update');
$update = new JUpdate();
$update->loadFromXml($url);
$package_url = trim($update->get('downloadurl', false)->_data);
if ($package_url) {
$url = $package_url;
}
unset($update);
}
// 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);
return $package;
}
开发者ID:adjaika,项目名称:J3Base,代码行数:41,代码来源:install.php
示例12: doInstallUpdate
public function doInstallUpdate($update_row)
{
// Load
$this->out('Loading update #' . $update_row->update_id . '...');
$update = new JUpdate();
$updateRow = JTable::getInstance('update');
$updateRow->load($update_row->update_id);
$update->loadFromXml($updateRow->detailsurl, $this->installer->params->get('minimum_stability', JUpdater::STABILITY_STABLE, 'int'));
$update->set('extra_query', $updateRow->extra_query);
// Download
$tmpPath = $this->config->get('tmp_path');
if (!is_writeable($tmpPath)) {
$tmpPath = JPATH_BASE . '/tmp';
}
$url = $update->downloadurl->_data;
if ($extra_query = $update->get('extra_query')) {
$url .= strpos($url, '?') === false ? '?' : '&';
$url .= $extra_query;
}
$this->out(' - Download ' . $url);
$p_file = JInstallerHelper::downloadPackage($url);
if ($p_file) {
$filePath = $tmpPath . '/' . $p_file;
} else {
$this->out(' - Download Failed, Attempting alternate download method...');
$urlFile = preg_replace('/^.*\\/(.*?)$/', '$1', $url);
$filePath = $tmpPath . '/' . $urlFile;
if ($fileHandle = @fopen($filePath, 'w+')) {
$curl = curl_init($url);
curl_setopt_array($curl, [CURLOPT_URL => $url, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_BINARYTRANSFER => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FILE => $fileHandle, CURLOPT_TIMEOUT => 50, CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)']);
$response = curl_exec($curl);
if ($response === false) {
$this->out(' - Download Failed: ' . curl_error($curl));
return false;
}
} else {
$this->out(' - Download Failed, Error writing ' . $filePath);
return false;
}
}
// Catch Error
if (!is_file($filePath)) {
$this->out(' - Download Failed/ File not found');
return false;
}
// Extracting Package
$this->out(' - Extracting Package...');
$package = JInstallerHelper::unpack($filePath);
if (!$package) {
$this->out(' - Extract Failed');
JInstallerHelper::cleanupInstall($filePath);
return false;
}
// Install the package
$this->out(' - Installing ' . $package['dir'] . '...');
$installer = JInstaller::getInstance();
$update->set('type', $package['type']);
if (!$installer->update($package['dir'])) {
$this->out(' - Update Error');
$result = false;
} else {
$this->out(' - Update Success');
$result = true;
}
// Cleanup the install files
$this->out(' - Cleanup');
JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
// Complete
return $result;
}
开发者ID:oookubox,项目名称:Joomla-cli-autoupdate,代码行数:70,代码来源:autoupdate.php
示例13: _getPackageUrl
/**
* Finds the url of the package to download.
*
* @param string $remote_manifest url to the manifest XML file of the remote package
*
* @return string|bool
*
* @since 2.5.7
*/
protected function _getPackageUrl($remote_manifest)
{
$update = new JUpdate();
$update->loadFromXml($remote_manifest);
$downloadUrlElement = $update->get('downloadurl', false);
if ($downloadUrlElement === false) {
return false;
}
return trim($downloadUrlElement->_data);
}
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:19,代码来源:languages.php
示例14: getUpdateInformation
/**
* Regreso un array con la información de la actualización de Jokte!
*
* @return array
* @since 1.1.9
*/
public function getUpdateInformation()
{
// Inicializo el array a retornar
// Ojo!!! Nueva global: VJOKTE
// La global JVERSION se mantiene por compatibilidad con extensiones Joomla
$ret = array('installed' => VJOKTE, 'latest' => null, 'object' => null);
// Busco la información en la BD
$db = $this->getDbo();
$query = $db->getQuery(true)->select('*')->from($db->nq('#__updates'))->where($db->nq('extension_id') . ' = ' . $db->q(700));
$db->setQuery($query);
$updateObject = $db->loadObject();
if (is_null($updateObject)) {
$ret['latest'] = VJOKTE;
return $ret;
} else {
$ret['latest'] = $updateObject->version;
}
// Busco los detalles completos de la actualización desde la URL
jimport('joomla.updater.update');
$update = new JUpdate();
$update->loadFromXML($updateObject->detailsurl);
//var_dump($update);
// Paso el objeto a actualizar
if ($ret['latest'] == VJOKTE) {
$ret['object'] = null;
} else {
$ret['object'] = $update;
}
return $ret;
}
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:36,代码来源:default.php
示例15: updateComponent
private function updateComponent()
{
JLoader::import('joomla.updater.update');
$db = JFactory::getDbo();
$update_site = array_shift($this->getUpdateSiteIds());
$query = $db->getQuery(true)->select($db->qn('update_id'))->from($db->qn('#__updates'))->where($db->qn('update_site_id') . ' = ' . $update_site);
$uid = $db->setQuery($query)->loadResult();
$update = new JUpdate();
$instance = JTable::getInstance('update');
$instance->load($uid);
$update->loadFromXML($instance->detailsurl);
if (isset($update->get('downloadurl')->_data)) {
$url = trim($update->downloadurl->_data);
} else {
return "No download URL found inside XML manifest";
}
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
if (!$tmp_dest) {
return "Joomla temp directory is empty, please set it before continuing";
} elseif (!JFolder::exists($tmp_dest)) {
return "Joomla temp directory does not exists, please set the correct path before continuing";
}
$p_file = JInstallerHelper::downloadPackage($url);
if (!$p_file) {
return "An error occurred while trying to download the latest version, double check your Download ID";
}
// Unpack the downloaded package file
$package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
if (!$package) {
return "An error occurred while unpacking the file, please double check your Joomla temp directory";
}
$installer = new JInstaller();
$installed = $installer->install($package['extractdir']);
// Let's cleanup the downloaded archive and the temp folder
if (JFolder::exists($package['extractdir'])) {
JFolder::delete($package['extractdir']);
}
if (JFile::exists($package['packagefile'])) {
JFile::delete($package['packagefile']);
}
if ($installed) {
return "Component successfully updated";
} else {
return "An error occurred while trying to update the component";
}
}
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:47,代码来源:updates.php
示例16: _getPackageUrl
/**
* Finds the url of the package to download.
*
* @param string $remote_manifest url to the manifest XML file of the remote package
*
* @return string|bool
*
* @since 2.5.7
*/
protected function _getPackageUrl($remote_manifest)
{
$update = new JUpdate();
$update->loadFromXml($remote_manifest);
$package_url = trim($update->get('downloadurl', false)->_data);
return $package_url;
}
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:16,代码来源:languages.php
示例17: getUpdateInformation
/**
* Returns an array with the Joomla! update information
*
* @return array
*
* @since 2.5.4
*/
public function getUpdateInformation()
{
// Initialise the return array
$ret = array('installed' => JVERSION, 'latest' => null, 'object' => null);
// Fetch the update information from the database
$db = $this->getDbo();
$query = $db->getQuery(true)->select('*')->from($db->nq('#__updates'))->where($db->nq('extension_id') . ' = ' . $db->q(700));
$db->setQuery($query);
$updateObject = $db->loadObject();
if (is_null($updateObject)) {
$ret['latest'] = JVERSION;
return $ret;
} else {
$ret['latest'] = $updateObject->version;
}
// Fetch the full udpate details from the update details URL
jimport('joomla.updater.update');
$update = new JUpdate();
$update->loadFromXML($updateObject->detailsurl);
// Pass the update object
if ($ret['latest'] == JVERSION) {
$ret['object'] = null;
} else {
$ret['object'] = $update;
}
return $ret;
}
开发者ID:joomline,项目名称:Joomla2.5.999,代码行数:34,代码来源:default.php
注:本文中的JUpdate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论