diff --git a/administrator/components/com_installer/controllers/database.php b/administrator/components/com_installer/controllers/service.php similarity index 60% rename from administrator/components/com_installer/controllers/database.php rename to administrator/components/com_installer/controllers/service.php index 0808a807ff97d..8d2bab72cb325 100644 --- a/administrator/components/com_installer/controllers/database.php +++ b/administrator/components/com_installer/controllers/service.php @@ -10,13 +10,13 @@ defined('_JEXEC') or die; /** - * Installer Database Controller + * Installer Service Controller * * @package Joomla.Administrator * @subpackage com_installer - * @since 2.5 + * @since 3.4 */ -class InstallerControllerDatabase extends JControllerLegacy +class InstallerControllerService extends JControllerLegacy { /** * Tries to fix missing database updates @@ -28,7 +28,7 @@ class InstallerControllerDatabase extends JControllerLegacy */ public function fix() { - $model = $this->getModel('database'); + $model = $this->getModel('service'); $model->fix(); // Purge updates @@ -39,6 +39,25 @@ public function fix() // Refresh versionable assets cache JFactory::getApplication()->flushAssets(); - $this->setRedirect(JRoute::_('index.php?option=com_installer&view=database', false)); + $this->setRedirect(JRoute::_('index.php?option=com_installer&view=service', false)); + } + + /** + * Tries to fix missing database updates + * + * @return void + * + * @since 2.5 + * @todo Purge updates has to be replaced with an events system + */ + public function checkFiles() + { + $model = $this->getModel('service'); + $result = $model->checkFiles(); + + $app = JFactory::getApplication(); + $app->setUserState('com_installer.service.files', $result); + + $this->setRedirect(JRoute::_('index.php?option=com_installer&view=service', false)); } } diff --git a/administrator/components/com_installer/helpers/installer.php b/administrator/components/com_installer/helpers/installer.php index 2a30c544f05b4..53ba21379972c 100644 --- a/administrator/components/com_installer/helpers/installer.php +++ b/administrator/components/com_installer/helpers/installer.php @@ -48,13 +48,8 @@ public static function addSubmenu($vName = 'install') $vName == 'discover' ); JHtmlSidebar::addEntry( - JText::_('COM_INSTALLER_SUBMENU_DATABASE'), - 'index.php?option=com_installer&view=database', - $vName == 'database' - ); - JHtmlSidebar::addEntry( - JText::_('COM_INSTALLER_SUBMENU_WARNINGS'), - 'index.php?option=com_installer&view=warnings', + JText::_('COM_INSTALLER_SUBMENU_SERVICE'), + 'index.php?option=com_installer&view=service', $vName == 'warnings' ); JHtmlSidebar::addEntry( diff --git a/administrator/components/com_installer/models/database.php b/administrator/components/com_installer/models/service.php similarity index 54% rename from administrator/components/com_installer/models/database.php rename to administrator/components/com_installer/models/service.php index 3a19f8a90deec..cb43ac61ddeb8 100644 --- a/administrator/components/com_installer/models/database.php +++ b/administrator/components/com_installer/models/service.php @@ -13,15 +13,48 @@ JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php'); /** - * Installer Manage Model + * Extension Manager Templates Model * * @package Joomla.Administrator * @subpackage com_installer * @since 1.6 */ -class InstallerModelDatabase extends InstallerModel +class InstallerModelService extends InstallerModel { - protected $_context = 'com_installer.discover'; + protected $_context = 'com_installer.service'; + + /** + * Extension Type + * @var string + */ + public $type = 'warnings'; + + /** + * Return the byte value of a particular string. + * + * @param string $val String optionally with G, M or K suffix + * + * @return integer size in bytes + * + * @since 1.6 + */ + public function return_bytes($val) + { + $val = trim($val); + $last = strtolower($val{strlen($val) - 1}); + switch ($last) + { + // The 'G' modifier is available since PHP 5.1.0 + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + } + + return $val; + } /** * Method to auto-populate the model state. @@ -52,7 +85,7 @@ protected function populateState($ordering = null, $direction = null) */ public function fix() { - if (!$changeSet = $this->getItems()) + if (!$changeSet = $this->getChangeset()) { return false; } @@ -64,12 +97,160 @@ public function fix() $this->fixDefaultTextFilters(); } + /** + * Checks files against MD5 sums for broken files + * + * @return array Broken files + */ + public function checkFiles() + { + $result = array(); + + if (!file_exists(JPATH_ADMINISTRATOR.'/checksums/joomla.md5')) + { + $result[] = JText::_('COM_INSTALLER_MSG_SERVICE_MD5_FILE_MISSING'); + return $result; + } + + $content = file_get_contents(JPATH_ADMINISTRATOR.'/checksums/joomla.md5'); + + $files = explode("\n", $content); + + foreach($files as $line) + { + if (trim($line) == '' || substr($line, 0, 1) == '#') + { + continue; + } + + list($hash, $file) = explode(' ', $line, 2); + if (md5_file(JPATH_ROOT.$file) != $hash) + { + $result[] = $file; + } + } + + return $result; + } + + /** + * Get broken files + * + * @return array Broken files + * + * @since 3.4 + */ + public function getFiles() + { + $app = JFactory::getApplication(); + + $files = $app->getUserState('com_installer.service.files', false); + if ($files) + { + $app->setUserState('com_installer.service.files', false); + } + + return $files; + } + + /** + * Load the data. + * + * @return array Messages + * + * @since 1.6 + */ + public function getItems() + { + static $messages; + if ($messages) + { + return $messages; + } + $messages = array(); + + $file_uploads = ini_get('file_uploads'); + if (!$file_uploads) + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADISDISABLEDDESC')); + } + + $upload_dir = ini_get('upload_tmp_dir'); + if (!$upload_dir) + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC')); + } + else + { + if (!is_writeable($upload_dir)) + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLE'), + 'description' => JText::sprintf('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC', $upload_dir)); + } + } + + $config = JFactory::getConfig(); + $tmp_path = $config->get('tmp_path'); + if (!$tmp_path) + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC')); + } + else + { + if (!is_writeable($tmp_path)) + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE'), + 'description' => JText::sprintf('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC', $tmp_path)); + } + } + + $memory_limit = $this->return_bytes(ini_get('memory_limit')); + if ($memory_limit < (8 * 1024 * 1024) && $memory_limit != -1) + { + // 8MB + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC')); + } + elseif ($memory_limit < (16 * 1024 * 1024) && $memory_limit != -1) + { + // 16MB + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC')); + } + + $post_max_size = $this->return_bytes(ini_get('post_max_size')); + $upload_max_filesize = $this->return_bytes(ini_get('upload_max_filesize')); + + if ($post_max_size < $upload_max_filesize) + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOST'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC')); + } + + if ($post_max_size < (8 * 1024 * 1024)) // 8MB + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC')); + } + + if ($upload_max_filesize < (8 * 1024 * 1024)) // 8MB + { + $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'), + 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC')); + } + + return $messages; + } + /** * Gets the changeset object * * @return JSchemaChangeset */ - public function getItems() + public function getChangeset() { $folder = JPATH_ADMINISTRATOR . '/components/com_admin/sql/updates/'; @@ -85,18 +266,6 @@ public function getItems() return $changeSet; } - /** - * Method to get a JPagination object for the data set. - * - * @return boolean - * - * @since 12.2 - */ - public function getPagination() - { - return true; - } - /** * Get version from #__schemas table * diff --git a/administrator/components/com_installer/models/warnings.php b/administrator/components/com_installer/models/warnings.php deleted file mode 100644 index 41e10e23d8249..0000000000000 --- a/administrator/components/com_installer/models/warnings.php +++ /dev/null @@ -1,144 +0,0 @@ - JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADISDISABLEDDESC')); - } - - $upload_dir = ini_get('upload_tmp_dir'); - if (!$upload_dir) - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC')); - } - else - { - if (!is_writeable($upload_dir)) - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLE'), - 'description' => JText::sprintf('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC', $upload_dir)); - } - } - - $config = JFactory::getConfig(); - $tmp_path = $config->get('tmp_path'); - if (!$tmp_path) - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC')); - } - else - { - if (!is_writeable($tmp_path)) - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE'), - 'description' => JText::sprintf('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC', $tmp_path)); - } - } - - $memory_limit = $this->return_bytes(ini_get('memory_limit')); - if ($memory_limit < (8 * 1024 * 1024) && $memory_limit != -1) - { - // 8MB - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC')); - } - elseif ($memory_limit < (16 * 1024 * 1024) && $memory_limit != -1) - { - // 16MB - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC')); - } - - $post_max_size = $this->return_bytes(ini_get('post_max_size')); - $upload_max_filesize = $this->return_bytes(ini_get('upload_max_filesize')); - - if ($post_max_size < $upload_max_filesize) - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOST'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC')); - } - - if ($post_max_size < (8 * 1024 * 1024)) // 8MB - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC')); - } - - if ($upload_max_filesize < (8 * 1024 * 1024)) // 8MB - { - $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'), - 'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC')); - } - - return $messages; - } -} diff --git a/administrator/components/com_installer/views/database/tmpl/default.php b/administrator/components/com_installer/views/database/tmpl/default.php deleted file mode 100644 index 10f95f4a370f0..0000000000000 --- a/administrator/components/com_installer/views/database/tmpl/default.php +++ /dev/null @@ -1,85 +0,0 @@ - -
-
- - sidebar)) : ?> -
- sidebar; ?> -
-
- -
- - errorCount === 0) : ?> -
- × - -
- 'other')); ?> - -
- × - -
- 'problems')); ?> - errorCount)); ?> -
-
    - filterParams) : ?> -
  • - - - schemaVersion != $this->changeSet->getSchema()) : ?> -
  • schemaVersion, $this->changeSet->getSchema()); ?>
  • - - - updateVersion, JVERSION) != 0) : ?> -
  • updateVersion, JVERSION); ?>
  • - - - errors as $line => $error) : ?> - queryType; - $msgs = $error->msgElements; - $file = basename($error->file); - $msg0 = (isset($msgs[0])) ? $msgs[0] : ' '; - $msg1 = (isset($msgs[1])) ? $msgs[1] : ' '; - $msg2 = (isset($msgs[2])) ? $msgs[2] : ' '; - $message = JText::sprintf($key, $file, $msg0, $msg1, $msg2); ?> -
  • - -
-
- - - - -
-
-
    -
  • schemaVersion); ?>
  • -
  • updateVersion); ?>
  • -
  • name); ?>
  • -
  • results['ok'])); ?>
  • -
  • results['skipped'])); ?>
  • -
-
-
- - - - - -
- -
diff --git a/administrator/components/com_installer/views/database/index.html b/administrator/components/com_installer/views/service/index.html similarity index 100% rename from administrator/components/com_installer/views/database/index.html rename to administrator/components/com_installer/views/service/index.html diff --git a/administrator/components/com_installer/views/warnings/tmpl/default.php b/administrator/components/com_installer/views/service/tmpl/default.php similarity index 52% rename from administrator/components/com_installer/views/warnings/tmpl/default.php rename to administrator/components/com_installer/views/service/tmpl/default.php index 03a9ce8ca092b..371ab9ac65af9 100644 --- a/administrator/components/com_installer/views/warnings/tmpl/default.php +++ b/administrator/components/com_installer/views/service/tmpl/default.php @@ -9,8 +9,8 @@ defined('_JEXEC') or die; ?> -
-
+
+ sidebar)) : ?>
sidebar; ?> @@ -19,16 +19,39 @@
+ messages)) + echo JHtml::_('sliders.start', 'warning-sliders', array('useCookie' => 1)); + + if (is_array($this->files)) { - echo '
×'. JText::_('COM_INSTALLER_MSG_WARNINGS_NONE').'
'; + echo JHtml::_('sliders.panel', JText::_('COM_INSTALLER_MSG_SERVICE_FILE_CHECKER'), str_replace(' ', '', JText::_('COM_INSTALLER_MSG_SERVICE_FILE_CHECKER'))); + echo '
'.JText::_('COM_INSTALLER_MSG_SERVICE_FILE_CHECKER_DESCRIPTION').'
'; + if (count($this->files)) + { + echo '
    '; + foreach ($this->files as $file) + { + echo '
  • '.$file.'
  • '; + } + echo '
'; + } + else + { + ?> +
+ × + +
+ 1)); + echo $this->loadTemplate('database'); + + if (count($this->messages)) + { foreach($this->messages as $message) { echo JHtml::_('sliders.panel', $message['message'], str_replace(' ', '', $message['message'])); @@ -36,8 +59,9 @@ } echo JHtml::_('sliders.panel', JText::_('COM_INSTALLER_MSG_WARNINGFURTHERINFO'), 'furtherinfo-pane'); echo '
'. JText::_('COM_INSTALLER_MSG_WARNINGFURTHERINFODESC') .'
'; - echo JHtml::_('sliders.end'); } + + echo JHtml::_('sliders.end'); ?>
@@ -45,5 +69,8 @@
+ + +
diff --git a/administrator/components/com_installer/views/service/tmpl/default_database.php b/administrator/components/com_installer/views/service/tmpl/default_database.php new file mode 100644 index 0000000000000..4dfdc760d94fc --- /dev/null +++ b/administrator/components/com_installer/views/service/tmpl/default_database.php @@ -0,0 +1,53 @@ + +errorCount > 0) : ?> + errorCount), str_replace(' ', '', JText::plural('COM_INSTALLER_MSG_N_SERVICE_DATABASE_ERROR_PANEL', $this->errorCount))); ?> +
    + filterParams) : ?> +
  • + + + schemaVersion != $this->changeSet->getSchema()) : ?> +
  • schemaVersion, $this->changeSet->getSchema()); ?>
  • + + + updateVersion, JVERSION) != 0) : ?> +
  • updateVersion, JVERSION); ?>
  • + + + errors as $line => $error) : ?> + queryType; + $msgs = $error->msgElements; + $file = basename($error->file); + $msg0 = (isset($msgs[0])) ? $msgs[0] : ' '; + $msg1 = (isset($msgs[1])) ? $msgs[1] : ' '; + $msg2 = (isset($msgs[2])) ? $msgs[2] : ' '; + $message = JText::sprintf($key, $file, $msg0, $msg1, $msg2); ?> +
  • + +
+ + + errorCount === 0) : ?> +
+ × + +
+ +
    +
  • schemaVersion); ?>
  • +
  • updateVersion); ?>
  • +
  • name); ?>
  • +
  • results['ok'])); ?>
  • +
  • results['skipped'])); ?>
  • +
\ No newline at end of file diff --git a/administrator/components/com_installer/views/database/tmpl/index.html b/administrator/components/com_installer/views/service/tmpl/index.html similarity index 100% rename from administrator/components/com_installer/views/database/tmpl/index.html rename to administrator/components/com_installer/views/service/tmpl/index.html diff --git a/administrator/components/com_installer/views/database/view.html.php b/administrator/components/com_installer/views/service/view.html.php similarity index 75% rename from administrator/components/com_installer/views/database/view.html.php rename to administrator/components/com_installer/views/service/view.html.php index 6a4138824c4e7..d4428d6e30045 100644 --- a/administrator/components/com_installer/views/database/view.html.php +++ b/administrator/components/com_installer/views/service/view.html.php @@ -12,13 +12,13 @@ include_once __DIR__ . '/../default/view.php'; /** - * Extension Manager Manage View + * Extension Manager Templates View * * @package Joomla.Administrator * @subpackage com_installer * @since 1.6 */ -class InstallerViewDatabase extends InstallerViewDefault +class InstallerViewService extends InstallerViewDefault { /** * Display the view @@ -31,9 +31,14 @@ class InstallerViewDatabase extends InstallerViewDefault */ public function display($tpl = null) { + $items = $this->get('Items'); + $this->messages = &$items; + + $this->files = $this->get('Files'); + // Get data from the model $this->state = $this->get('State'); - $this->changeSet = $this->get('Items'); + $this->changeSet = $this->get('Changeset'); $this->errors = $this->changeSet->check(); $this->results = $this->changeSet->getStatus(); $this->schemaVersion = $this->get('SchemaVersion'); @@ -72,9 +77,10 @@ protected function addToolbar() /* * Set toolbar items for the page */ - JToolbarHelper::custom('database.fix', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_DATABASE_FIX', false, false); + JToolbarHelper::custom('service.fix', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_SERVICE_DATABASE_FIX', false, false); JToolbarHelper::divider(); + JToolbarHelper::custom('service.checkFiles', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_SERVICE_CHECK_FILES', false, false); parent::addToolbar(); - JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_DATABASE'); + JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_SERVICE'); } } diff --git a/administrator/components/com_installer/views/warnings/index.html b/administrator/components/com_installer/views/warnings/index.html deleted file mode 100644 index 2efb97f319a35..0000000000000 --- a/administrator/components/com_installer/views/warnings/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/administrator/components/com_installer/views/warnings/tmpl/index.html b/administrator/components/com_installer/views/warnings/tmpl/index.html deleted file mode 100644 index 2efb97f319a35..0000000000000 --- a/administrator/components/com_installer/views/warnings/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/administrator/components/com_installer/views/warnings/view.html.php b/administrator/components/com_installer/views/warnings/view.html.php deleted file mode 100644 index 8f70c853420ff..0000000000000 --- a/administrator/components/com_installer/views/warnings/view.html.php +++ /dev/null @@ -1,51 +0,0 @@ -get('Items'); - $this->messages = &$items; - parent::display($tpl); - } - - /** - * Add the page title and toolbar. - * - * @return void - * - * @since 1.6 - */ - protected function addToolbar() - { - parent::addToolbar(); - JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_WARNINGS'); - } -} diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index c7e399f2f31fd..b169fa7f8791f 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -67,7 +67,7 @@ COM_INSTALLER_MSG_DATABASE_DROP_COLUMN="Table %2$s should not have column %3$s. COM_INSTALLER_MSG_DATABASE_DROP_INDEX="Table %2$s should not have index %3$s. (From file %1$s.)" COM_INSTALLER_MSG_DATABASE_ERRORS="Warning: Database is not up to date!" COM_INSTALLER_MSG_DATABASE_FILTER_ERROR="No default text filters found." -COM_INSTALLER_MSG_DATABASE_INFO="Other Information" +COM_INSTALLER_MSG_SERVICE_DATABASE_INFO="Database Information" COM_INSTALLER_MSG_DATABASE_OK="Database table structure is up to date." COM_INSTALLER_MSG_DATABASE_SCHEMA_ERROR="Database schema version (%s) does not match CMS version (%s)." COM_INSTALLER_MSG_DATABASE_SCHEMA_VERSION="Database schema version (in #__schemas): %s." @@ -98,8 +98,8 @@ COM_INSTALLER_MSG_LANGUAGES_CANT_FIND_REMOTE_PACKAGE="The installer can't get th COM_INSTALLER_MSG_LANGUAGES_NOLANGUAGES="There are no available languages to install at the moment. Please click on the "Find languages" button to check for updates on the Joomla Languages server. You will need an internet connection for this to work." COM_INSTALLER_MSG_LANGUAGES_TRY_LATER="Try again later or contact the language team coordinator" COM_INSTALLER_MSG_MANAGE_NOEXTENSION="There are no extensions installed matching your query" -COM_INSTALLER_MSG_N_DATABASE_ERROR_PANEL="%d Database Problems Found" -COM_INSTALLER_MSG_N_DATABASE_ERROR_PANEL_1="1 Database Problem Found" +COM_INSTALLER_MSG_N_SERVICE_DATABASE_ERROR_PANEL="%d Database Problems Found" +COM_INSTALLER_MSG_N_SERVICE_DATABASE_ERROR_PANEL_1="1 Database Problem Found" COM_INSTALLER_MSG_UPDATE_ERROR="Error updating %s." COM_INSTALLER_MSG_UPDATE_NODESC="No description available for this item." COM_INSTALLER_MSG_UPDATE_NOUPDATES="There are no updates available at the moment. Please check again later." @@ -206,3 +206,10 @@ COM_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR="Cannot connect to the Joom COM_INSTALLER_WEBINSTALLER_LOAD_APPS="Click to load extensions browser" COM_INSTALLER_XML_DESCRIPTION="Installer component for adding, removing and upgrading extensions" JLIB_RULES_SETTING_NOTES="1. If you change the setting, it will apply to this component. Note that:
Inherited means that the permissions from global configuration and parent group will be used.
Denied means that no matter what the global configuration or parent group settings are, the group being edited cannot take this action on this component.
Allowed means that the group being edited will be able to take this action for this component (but if this is in conflict with the global configuration or parent group it will have no impact; a conflict will be indicated by Not Allowed (Locked) under Calculated Settings).
2. If you select a new setting, click Save to refresh the calculated settings." +COM_INSTALLER_MSG_SERVICE_MD5_FILE_MISSING="The MD5-file to check the files against is missing! Please make sure that there is a /administrator/checksums/joomla.md5 file present" +COM_INSTALLER_SUBMENU_SERVICE="Service" +COM_INSTALLER_TOOLBAR_SERVICE_DATABASE_FIX="Fix Database" +COM_INSTALLER_TOOLBAR_SERVICE_CHECK_FILES="Check Files" +COM_INSTALLER_MSG_SERVICE_FILE_CHECKER_DESCRIPTION="This slider displays all core files that Joomla identified as modified. Please keep in mind that some folders have been excluded from this, for example the core templates and the .htaccess file." +COM_INSTALLER_MSG_SERVICE_FILE_CHECKER="Core File Check" +COM_INSTALLER_MSG_FILES_OK="All files seem to be OK" \ No newline at end of file diff --git a/cli/createfilecheck.php b/cli/createfilecheck.php new file mode 100644 index 0000000000000..f1b65b972c322 --- /dev/null +++ b/cli/createfilecheck.php @@ -0,0 +1,132 @@ +load('files_joomla.sys', JPATH_SITE, null, false, false) +// Fallback to the files_joomla file in the default language +|| $lang->load('files_joomla.sys', JPATH_SITE, null, true); + +/** + * A command line cron job to attempt to remove files that should have been deleted at update. + * + * @package Joomla.Cli + * @since 3.0 + */ +class CreatecheckfilesCli extends JApplicationCli +{ + protected $excludefolders = array( + '/build', + '/nbprojects', + '/tests', + '/templates/beez3', + '/templates/protostar', + '/tmp', + '/.git' + ); + + protected $excludefiles = array( + 'configuration.php', + '.htaccess', + 'htaccess.txt', + 'robots.txt.dist' + ); + + /** + * Entry point for CLI script + * + * @return void + * + * @since 3.0 + */ + public function doExecute() + { + echo "Creating checksums... \n"; + $files = $this->readFolder(); + echo "Writing checksum file... \n"; + jimport('joomla.filesystem.file'); + $buffer = implode("\n", $files); + JFile::write(JPATH_ADMINISTRATOR . '/checksums/joomla.md5', $buffer); + echo "Done!"; + } + + /** + * Read a folder and create MD5s for all files recursively + * + * @param string $dir Folder to read + * + * @return array List of MD5s with files + */ + protected function readFolder($dir = '') + { + $result = array(); + + if (!$dh = @opendir(JPATH_BASE . $dir)) + { + return array(); + } + + if (in_array($dir, $this->excludefolders)) + { + return array(); + } + + echo "Reading $dir \n"; + + while (false !== ($obj = readdir($dh))) + { + if ($obj == '.' || $obj == '..' || $obj == 'index.html' || in_array($dir . '/' . $obj, $this->excludefiles)) + { + continue; + } + + $file = JPATH_BASE . $dir . '/' . $obj; + + if (is_dir($file)) + { + $result = array_merge($result, $this->readFolder($dir . '/' . $obj)); + } + elseif (is_file($file)) + { + $result[] = md5_file($file) . ' ' . $dir . '/' . $obj; + } + } + return $result; + } +} + +// Instantiate the application object, passing the class name to JCli::getInstance +// and use chaining to execute the application. +JApplicationCli::getInstance('CreatecheckfilesCli')->execute();