本文整理汇总了PHP中JoomlapackModelRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP JoomlapackModelRegistry类的具体用法?PHP JoomlapackModelRegistry怎么用?PHP JoomlapackModelRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoomlapackModelRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: finalize
/**
* Finalises the archive by compressing it. Overrides parent's method
* @return boolean TRUE on success, FALSE on failure
*/
function finalize()
{
// Get gzip's binary location
$registry = JoomlapackModelRegistry::getInstance();
$gzip = escapeshellcmd($registry->get('gzipbinary'));
// Construct and run command line
$command = "{$gzip} " . escapeshellcmd($this->_tempFilename);
JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerTARGZ :: Calling gzip. The command line is:");
JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, $command);
$result = shell_exec($command);
// Normally, gzip should be silent as a fish. If anything was sput out,
// there must have been an error.
if (strlen(trim($result)) > 0) {
$errorMessage = "Error calling gzip: " . $result . " \n Command line was: \n " . $command . " \n Please check file permissions and examine the result message for any hints regarding the problem tar faced archiving your files.";
$this->setError($errorMessage);
return false;
}
// Now, unregister the temp file (which no longer exists), register the gzipped file as
// a new temp file and try to move it
JoomlapackCUBETempfiles::unregisterAndDeleteTempFile($this->_tempFilename);
$this->_tempFilename = JoomlapackCUBETempfiles::registerTempFile(basename($this->_archiveFilename));
copy($this->_tempFilename, $this->_archiveFilename);
JoomlapackCUBETempfiles::unregisterAndDeleteTempFile($this->_tempFilename);
// If no errors occured, return true
return true;
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:30,代码来源:targz.php
示例2: selectAlgorithm
/**
* Selects the algorithm to use based on the domain name
*
* @param string $domain The domain to return algorithm for
* @return string The algorithm to use
*/
function selectAlgorithm($domain)
{
if (!class_exists('JoomlapackModelregistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
switch ($domain) {
case "installer":
switch ($registry->get('BackupType')) {
case 'full':
return 'smart';
break;
default:
return '(null)';
break;
}
break;
case "PackDB":
return $registry->get('dbAlgorithm');
break;
case "Packing":
switch ($registry->get('BackupType')) {
case 'full':
return $registry->get('packAlgorithm');
break;
default:
return '(null)';
break;
}
break;
default:
return "(null)";
break;
}
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:41,代码来源:algorunner.php
示例3: display
function display()
{
$task = JRequest::getCmd('task', 'default');
switch ($task) {
case 'showcomment':
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option') . '&view=buadmin');
JoomlapackHelperUtils::addLiveHelp('buadmin');
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css');
jpimport('models.statistics', true);
$model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel');
$model->setId(JRequest::getInt('id'));
$record =& $model->getStatistic();
$this->assignRef('record', $record);
JRequest::setVar('tpl', 'comment');
break;
case 'restore':
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
JRequest::setVar('tpl', 'restore');
$this->assign('password', JRequest::getVar('password'));
$this->assign('link', JRequest::getVar('linktarget'));
break;
default:
$registry =& JoomlapackModelRegistry::getInstance();
$easy = $registry->get('easymode', false);
if (!$easy) {
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
} else {
JToolBarHelper::title(JText::_('JOOMLAPACKEASY') . ': <small><small>' . JText::_('BUADMIN') . '</small></small>');
}
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JToolBarHelper::deleteList();
JToolBarHelper::custom('deletefiles', 'delete.png', 'delete_f2.png', JText::_('STATS_LABEL_DELETEFILES'), true);
JToolBarHelper::save('download', JText::_('STATS_LOG_DOWNLOAD'));
if (!$easy) {
JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_VIEWCOMMENT'));
if (JPSPECIALEDITION) {
JToolBarHelper::publish('restore', JText::_('STATS_LOG_RESTORE'));
}
}
JToolBarHelper::spacer();
if (!$easy) {
JoomlapackHelperUtils::addLiveHelp('buadmin');
} else {
JoomlapackHelperUtils::addLiveHelp('buadmineasy');
}
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css');
jpimport('models.statistics', true);
$model =& JoomlapackModelStatistics::getInstance('Statistics', 'JoomlapackModel');
$list =& $model->getStatisticsListWithMeta();
$this->assignRef('list', $list);
$this->assignRef('pagination', $model->getPagination());
$this->assign('easy', $easy);
break;
}
parent::display(JRequest::getVar('tpl'));
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:60,代码来源:view.html.php
示例4: init
/**
* Implements the init method of JoomlapackFilter
*
*/
function init()
{
$jreg =& JFactory::getConfig();
$configuration =& JoomlapackModelRegistry::getInstance();
$this->_skipContainedDirectoriesFilter = array();
$temp = $this->_loadFilters();
if (DS == '\\') {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter);
}
}
} else {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_skipContainedDirectoriesFilter[] = JPATH_SITE . DS . $filter;
}
}
}
// Add temporary and output directories
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($configuration->get('OutputDirectory')));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($configuration->getTemporaryDirectory()));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath($jreg->getValue('config.tmp_path')));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_CACHE));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_ADMINISTRATOR . DS . 'cache'));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JoomlapackHelperUtils::TranslateWinPath(JPATH_ROOT . DS . 'cache'));
// Hack: add the same paths untranslated
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($configuration->get('OutputDirectory'));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($configuration->getTemporaryDirectory());
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash($jreg->getValue('config.tmp_path'));
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_CACHE);
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_ADMINISTRATOR . DS . 'cache');
$this->_skipContainedDirectoriesFilter[] = JoomlapackHelperUtils::TrimTrailingSlash(JPATH_ROOT . DS . 'cache');
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:38,代码来源:skipdirs.php
示例5: display
function display()
{
// Decide what to do; delegate data loading to private methods
$task = JRequest::getCmd('task', 'display');
$layout = JRequest::getCmd('layout', 'default');
JToolBarHelper::title(JText::_('JOOMLAPACK') . ': <small><small>' . JText::_('CRONMAN') . '</small></small>');
switch ($layout) {
case 'default_edit':
// Get the CRON configuration definition
if ($task == 'add') {
$definition = null;
$registry =& JoomlapackModelRegistry::getInstance();
$secret = $registry->get('secret_key');
$this->assign('secret', $secret);
} else {
$id = JRequest::getInt('id', 0);
$model =& $this->getModel('cronman');
$definition = $model->getConfiguration($id);
}
$this->assign('definition', $definition);
// Get some lists and pass them on
$model =& $this->getModel('cronman');
$postops = $model->getPostOpList();
$this->assign('postops', $postops);
// Add the buttons
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
break;
case 'default':
default:
$this->_default();
break;
}
// Load the util helper
$this->loadHelper('utils');
// Add a spacer, a help button and show the template
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('profiles');
// Load a list of profiles
$model =& $this->getModel('cronman');
jpimport('models.profiles', true);
$profilesmodel = new JoomlapackModelProfiles();
$profiles_objects = $profilesmodel->getProfilesList(true);
$profiles = array();
foreach ($profiles_objects as $profile) {
$id = $profile->id;
$profiles[(string) $id] = $profile->description;
}
unset($profiles_objects);
unset($profilesmodel);
$this->assign('profiles', $profiles);
// Add JoomlaPack CSS
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . '/components/com_joomlapack/assets/css/joomlapack.css');
// Show the view
parent::display();
}
开发者ID:Ratmir15,项目名称:Joomla---formula-of-success,代码行数:58,代码来源:view.html.php
示例6: agree
function agree()
{
$registry =& JoomlapackModelRegistry::getInstance();
$registry->set('nagscreen', true);
$registry->save();
$registry->reload();
$this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=cpanel');
parent::redirect();
}
开发者ID:Ratmir15,项目名称:Joomla---formula-of-success,代码行数:9,代码来源:nag.php
示例7: WriteLog
/**
* Writes a line to the log, if the log level is high enough
*
* @param int|bool $level The log level (_JP_LOG_XX constants). Use FALSE to pause logging, TRUE to resume logging
* @param string $message The message to write to the log
*/
function WriteLog($level, $message)
{
static $configuredLoglevel;
static $site_root;
if (empty($site_root)) {
if (!class_exists('JoomlapackHelperUtils')) {
jpimport('helpers.utils', true);
}
$site_root = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE);
}
if (empty($configuredLoglevel) or $level === true) {
// Load the registry
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
// Fetch log level
$configuredLoglevel = $registry->get('logLevel');
}
if ($level === false) {
// Pause logging
$configuredLogLevel = false;
return;
}
// Catch paused logging
if ($configuredLoglevel === false) {
return;
}
if ($configuredLoglevel >= $level && $configuredLoglevel != 0) {
$logName = JoomlapackLogger::logName();
$message = str_replace(JPATH_SITE, "<root>", $message);
$message = str_replace($site_root, "<root>", $message);
// Fix 2.4 - Also replace the translated path on Windows machines
$message = str_replace("\n", ' \\n ', $message);
// Fix 1.1.1 - Handle (error) messages containing newlines (by nicholas)
switch ($level) {
case _JP_LOG_ERROR:
$string = "ERROR |";
break;
case _JP_LOG_WARNING:
$string = "WARNING |";
break;
case _JP_LOG_INFO:
$string = "INFO |";
break;
default:
$string = "DEBUG |";
break;
}
$string .= @strftime("%y%m%d %T") . "|{$message}\r\n";
$fp = @fopen($logName, "at");
if (!($fp === FALSE)) {
@fwrite($fp, $string);
@fclose($fp);
}
}
}
开发者ID:joomla-example,项目名称:joomla-repo,代码行数:63,代码来源:logger.php
示例8: display
/**
* Displays the editor page
*
*/
function display()
{
// Make sure we're on easy mode; otherwise redirect to Control Panel
$registry =& JoomlapackModelRegistry::getInstance();
if (!$registry->get('easymode', false)) {
$this->setRedirect(JURI::base() . 'index.php?option=' . JRequest::getCmd('option') . '&view=cpanel');
$this->redirect();
}
parent::display();
}
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:14,代码来源:configeasy.php
示例9: deleteTempFiles
function deleteTempFiles()
{
$configuration =& JoomlapackModelRegistry::getInstance();
$tempFiles = JoomlapackCUBETables::UnserializeVar('CUBETempFiles', array());
foreach ($tempFiles as $fileName) {
$file = $configuration->getTemporaryDirectory() . DS . $fileName;
if (file_exists($file)) {
@unlink($file);
}
}
JoomlapackCUBETables::DeleteVar('CUBETempFiles');
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:12,代码来源:tempfiles.php
示例10: display
function display()
{
$task = JRequest::getCmd('task', 'default');
$act = JRequest::getCmd('act', 'start');
// Set the toolbar title
JToolBarHelper::title(JText::_('JOOMLAPACK') . ':: <small><small>' . JText::_('BACKUP') . '</small></small>');
// Load the util helper
$this->loadHelper('utils');
switch ($task) {
case 'backup':
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
$this->assign('backupMethod', $registry->get('backupMethod'));
break;
case 'error':
$this->assign('errormessage', JRequest::getString('message'));
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
break;
case 'finised':
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('backup');
break;
default:
// Add some buttons
JToolBarHelper::back('Back', 'index.php?option=' . JRequest::getCmd('option'));
JToolBarHelper::spacer();
JoomlapackHelperUtils::addLiveHelp('backup');
// Load model
$model =& $this->getModel('backup');
// Load the Status Helper
jpimport('helpers.status', true);
$helper =& JoomlapackHelperStatus::getInstance();
// Pass on data
$this->assign('haserrors', !$helper->status);
$this->assign('hasquirks', $helper->hasQuirks());
$this->assign('quirks', $helper->getQuirksCell(!$helper->status));
$this->assign('description', $model->getDescription());
$this->assign('comment', $model->getComment());
$this->assign('profile', $model->getProfileID());
$this->assign('profilelist', $model->getProfilesList());
break;
}
$css = JURI::base() . 'components/com_joomlapack/assets/css/joomlapack.css';
$document =& JFactory::getDocument();
$document->addStyleSheet($css);
parent::display(JRequest::getCmd('tpl', null));
}
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:50,代码来源:view.html.php
示例11: getLogFilename
function getLogFilename()
{
// Make sure the registry model is loaded
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
// Get output directory
$registry =& JoomlapackModelRegistry::getInstance();
$outdir = $registry->get('OutputDirectory');
// Get log's file name
$logName = $outdir . DS . 'joomlapack.log';
// Tidy up the path to the file
jimport('joomla.filesystem.file');
return $logName;
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:15,代码来源:log.php
示例12: _checkPermissions
/**
* Check that the user has sufficient permissions, or die in error
*
*/
function _checkPermissions()
{
jpimport('models.registry', true);
$registry =& JoomlapackModelRegistry::getInstance();
// Is frontend backup enabled?
$febEnabled = $registry->get('enableFrontend');
if (!$febEnabled) {
die('403 ' . JText::_('ERROR_NOT_ENABLED'));
}
// Is the key good?
$key = JRequest::getVar('key');
$validKey = $registry->get('secretWord');
if ($key != $validKey) {
die('403 ' . JText::_('ERROR_INVALID_KEY'));
}
}
开发者ID:joomla-example,项目名称:joomla-repo,代码行数:20,代码来源:backup.php
示例13: troubleshooter
/**
* Applies the troubleshooter's suggestion and moves on to the backup page
*
*/
function troubleshooter()
{
$model =& $this->getModel('cpanel');
$registry =& JoomlapackModelRegistry::getInstance();
$nextStep = $model->nextSettingsMode();
if (is_null($nextStep)) {
// Oops! No further action to take, brother!
$this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=cpanel', JText::_('CPANEL_TROUBLESHOOTER_ERROR'), 'error');
return;
} else {
$registry->set('settingsmode', $nextStep);
$registry->save();
$registry->reload();
$this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=backup');
}
}
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:20,代码来源:cpanel.php
示例14: array
function &getFolders($folder)
{
// Was the breakflag set BEFORE starting? -- This workaround is required due to PHP5 defaulting to assigning variables by reference
$breakflag_before_process = $this->BREAKFLAG ? true : false;
// Reset break flag before continuing
$this->BREAKFLAG = false;
// Initialize variables
$arr = array();
$false = false;
if (!is_dir($folder)) {
return $false;
}
$counter = 0;
$registry =& JoomlapackModelRegistry::getInstance();
$maxCounter = $registry->get('mnMaxFragmentFiles', 50) * 2;
$cube =& JoomlapackCUBE::getInstance();
$allowBreakflag = $cube->operationCounter != 0 && !$breakflag_before_process;
$handle = @opendir($folder);
// If directory is not accessible, just return FALSE
if ($handle === FALSE) {
$cube =& JoomlapackCUBE::getInstance();
$cube->addWarning('Unreadable directory ' . $folder);
return $false;
}
while (($file = @readdir($handle)) !== false && !$this->BREAKFLAG) {
if ($file != '.' && $file != '..') {
// # Fix 2.4: Do not add DS if we are on the site's root and it's an empty string
$ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DS ? '' : DS;
$dir = $folder . $ds . $file;
$isDir = is_dir($dir);
if ($isDir) {
$data = JPISWINDOWS ? JoomlapackHelperUtils::TranslateWinPath($dir) : $dir;
if ($data) {
$arr[] = $data;
}
}
}
$counter++;
if ($counter >= $maxCounter) {
$this->BREAKFLAG = $allowBreakflag;
}
}
@closedir($handle);
return $arr;
}
开发者ID:joomla-example,项目名称:joomla-repo,代码行数:45,代码来源:smart.php
示例15: init
/**
* Loads the file filters off the database and stores them in the _singleFileFilters array
*
*/
function init()
{
$configuration =& JoomlapackModelRegistry::getInstance();
$temp = $this->_loadFilters();
$this->_singleFileFilters = array();
if (DS == '\\') {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_singleFileFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter);
}
}
} else {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_singleFileFilters[] = JPATH_SITE . DS . $filter;
}
}
}
}
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:23,代码来源:sff.php
示例16: display
/**
* Default task; shows the initial page where the user selects a profile
* and enters description and comment
*
*/
function display()
{
$format = JRequest::getCmd('format', 'html');
// For raw view with default task use the default_raw.php template file
if ($format == 'raw') {
JRequest::setVar('tpl', 'raw');
}
$registry =& JoomlapackModelRegistry::getInstance();
if ($format != 'raw' && $registry->get('easymode', false)) {
// Easy Mode enabled and the defaut backup view was requested. Skip to backup start.
$model =& $this->getModel('backup');
JRequest::setVar('description', $model->getDescription());
JRequest::setVar('comment', $model->getComment());
JRequest::setVar('profile', 1);
JRequest::setVar('task', 'backup');
$this->backup();
return;
}
parent::display();
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:25,代码来源:backup.php
示例17: init
/**
* Implements the init method of JoomlapackFilter
*
*/
function init()
{
$configuration =& JoomlapackModelRegistry::getInstance();
$temp = $this->_loadFilters();
$this->_folderFilters = array();
if (DS == '\\') {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_folderFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . $filter);
}
}
} else {
if (is_array($temp)) {
foreach ($temp as $filter) {
$this->_folderFilters[] = JPATH_SITE . DS . $filter;
}
}
}
// Add any leftover installation directory to exclusion filters. THIS SHOULD NEVER BE NECESSARY ON A REAL SITE!
$this->_folderFilters[] = JoomlapackHelperUtils::TranslateWinPath(JPATH_SITE . DS . 'installation');
}
开发者ID:albertobraschi,项目名称:Hab,代码行数:25,代码来源:def.php
示例18: array
function &getFolders($folder)
{
// Initialize variables
$arr = array();
$false = false;
if (!is_dir($folder)) {
return $false;
}
$counter = 0;
$registry =& JoomlapackModelRegistry::getInstance();
$maxCounter = $registry->get('mnMaxFragmentFiles', 50) * 2;
$cube =& JoomlapackCUBE::getInstance();
$allowBreakflag = $cube->operationCounter != 0;
$handle = @opendir($folder);
// If directory is not accessible, just return FALSE
if ($handle === FALSE) {
JoomlapackLogger::WriteLog(_JP_LOG_WARNING, 'Unreadable directory ' . $dirName);
return $false;
}
while (($file = @readdir($handle)) !== false && !$this->BREAKFLAG) {
if ($file != '.' && $file != '..') {
$dir = $folder . DS . $file;
$isDir = is_dir($dir);
if ($isDir) {
$data = JPISWINDOWS ? JoomlapackHelperUtils::TranslateWinPath($dir) : $dir;
if ($data) {
$arr[] = $data;
}
}
}
$counter++;
if ($counter >= $maxCounter) {
$this->BREAKFLAG = $allowBreakflag;
}
}
@closedir($handle);
return $arr;
}
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:38,代码来源:smart.php
示例19: initialize
/**
* Initialises the archiver class, creating the archive from an existent
* installer's JPA archive.
*
* @param string $sourceJPAPath Absolute path to an installer's JPA archive
* @param string $targetArchivePath Absolute path to the generated archive
* @param array $options A named key array of options (optional). This is currently not supported
* @access public
*/
function initialize($sourceJPAPath, $targetArchivePath, $options = array())
{
JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerTAR :: initialize - archive {$targetArchivePath}");
// Get names of temporary files
$configuration =& JoomlapackModelRegistry::getInstance();
$this->_dataFileName = $targetArchivePath;
// Try to kill the archive if it exists
JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerTAR :: Killing old archive");
$fp = fopen($this->_dataFileName, "wb");
if (!($fp === false)) {
ftruncate($fp, 0);
fclose($fp);
} else {
@unlink($this->_dataFileName);
}
if (!@touch($this->_dataFileName)) {
$this->setError(JText::_('CUBE_ARCHIVER_CANTWRITE'));
return false;
}
$this->_tarObject = new Archive_Tar($targetArchivePath);
$this->_tarObject->owningObject =& $this;
parent::initialize($sourceJPAPath, $targetArchivePath, $options);
}
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:32,代码来源:tar.php
示例20: WriteLog
/**
* Writes a line to the log, if the log level is high enough
*
* @param integer $level The log level (_JP_LOG_XX constants)
* @param string $message The message to write to the log
*/
function WriteLog($level, $message)
{
// Load the registry
if (!class_exists('JoomlapackModelRegistry')) {
jpimport('models.registry', true);
}
$registry =& JoomlapackModelRegistry::getInstance();
// Fetch log level
$configuredLoglevel = $registry->get('logLevel');
if ($configuredLoglevel >= $level && $configuredLoglevel != 0) {
$logName = JoomlapackLogger::logName();
$message = str_replace(JPATH_SITE, "<root>", $message);
$message = str_replace("\n", ' \\n ', $message);
// Fix 1.1.1 - Handle (error) messages containing newlines (by nicholas)
switch ($level) {
case _JP_LOG_ERROR:
$string = "ERROR |";
break;
case _JP_LOG_WARNING:
$string = "WARNING |";
break;
case _JP_LOG_INFO:
$string = "INFO |";
break;
default:
$string = "DEBUG |";
break;
}
$string .= @strftime("%y%m%d %T") . "|{$message}\r\n";
$fp = @fopen($logName, "at");
if (!($fp === FALSE)) {
@fwrite($fp, $string);
@fclose($fp);
}
}
}
开发者ID:jnvilo,项目名称:tomasinasanctuary.org,代码行数:42,代码来源:logger.php
注:本文中的JoomlapackModelRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论