Skip to content

Commit

Permalink
Issue #1399: Installer menu adjustments. Enabling by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
quicksketch committed May 11, 2016
1 parent b1a1111 commit d932498
Show file tree
Hide file tree
Showing 37 changed files with 710 additions and 661 deletions.
2 changes: 1 addition & 1 deletion core/includes/file.inc
Expand Up @@ -1408,7 +1408,7 @@ function file_space_used($uid = NULL, $status = FILE_STATUS_PERMANENT) {
* unique.
* - FILE_EXISTS_ERROR: Do nothing and return FALSE.
*
* @return
* @return File|FALSE|NULL
* An object containing the file information if the upload succeeded, FALSE
* in the event of an error, or NULL if no file was uploaded. The
* documentation for the "File interface" group, which you can find under
Expand Down
9 changes: 7 additions & 2 deletions core/includes/filetransfer/filetransfer.inc
Expand Up @@ -60,6 +60,8 @@ abstract class FileTransfer {
$this->setChroot();
return $this->chroot;
}

return NULL;
}

/**
Expand All @@ -86,7 +88,7 @@ abstract class FileTransfer {
* @see http://php.net/chmod
*
* @param string $path
* @param long $mode
* @param int $mode
* @param bool $recursive
*/
public final function chmod($path, $mode, $recursive = FALSE) {
Expand Down Expand Up @@ -155,6 +157,9 @@ abstract class FileTransfer {
*
* @param $path
* A path to check against the jail.
*
* @throws FileTransferException
*
*/
protected final function checkPath($path) {
$full_jail = $this->chroot . $this->jail;
Expand Down Expand Up @@ -382,7 +387,7 @@ interface FileTransferChmodInterface {
*
* @param string $path
* Path to change permissions of.
* @param long $mode
* @param int $mode
* The new file permission mode to be passed to chmod().
* @param boolean $recursive
* Pass TRUE to recursively chmod the entire directory specified in $path.
Expand Down
7 changes: 4 additions & 3 deletions core/includes/install.core.inc
Expand Up @@ -1849,9 +1849,10 @@ function install_configure_form_submit($form, &$form_state) {
->set('default_country', _install_get_timezone_country($form_state['values']['date_default_timezone']))
->save();

// Enable update.module if this option was selected.
if ($form_state['values']['update_status_module'][1]) {
module_enable(array('update'), FALSE);
// Enable checking for updates on cron.
if (module_exists('update')) {
// Set the update interval to 0 if automatic checking is disabled.
config_set('update.settings', 'update_interval_days', (int) $form_state['values']['update_status_module'][1]);

// Add the site maintenance account's email address to the list of
// addresses to be notified when updates are available, if selected.
Expand Down
8 changes: 8 additions & 0 deletions core/includes/module.inc
Expand Up @@ -958,12 +958,20 @@ function module_invoke_all($hook) {

/**
* Returns an array of modules that have been merged into Backdrop core.
*
* Modules that have been merged into core may not be enabled on newer
* installations of Backdrop. Note that some modules have been merged into core
* but kept the same name as they did previously. For example "redirect" module
* existed both as a contrib module and then later as a core module. Because
* the core module shares the same name, it's not included in this list.
* Including it would prevent the core module from being enabled.
*/
function backdrop_merged_modules() {
return array(
'token', // Backdrop 1.1.0.
'pathauto', // Backdrop 1.1.0.
'transliteration', // Backdrop 1.3.0.
'project_browser', // Backdrop 1.4.0.
);
}

Expand Down
46 changes: 41 additions & 5 deletions core/includes/updater.inc
Expand Up @@ -44,12 +44,11 @@ interface BackdropUpdaterInterface {
/**
* Determine if the Updater can handle the project provided in $directory.
*
* @todo: Provide something more rational here, like a project spec file.
*
* @param string $directory
* The full path to the package directory.
*
* @return bool
* TRUE if the project is installed, FALSE if not.
* TRUE if the project within the directory is supported by this updater.
*/
public static function canUpdateDirectory($directory);

Expand All @@ -67,7 +66,7 @@ interface BackdropUpdaterInterface {
/**
* Base class for Updaters used in Backdrop.
*/
class Updater {
abstract class Updater implements BackdropUpdaterInterface {

/**
* @var string $source Directory to install from.
Expand All @@ -90,6 +89,8 @@ class Updater {
* Directory of a Backdrop project.
*
* @return Updater
*
* @throws UpdaterException
*/
public static function factory($source) {
if (is_dir($source)) {
Expand All @@ -109,6 +110,8 @@ class Updater {
*
* @return string
* The class name which can work with this project type.
*
* @throws UpdaterException
*/
public static function getUpdaterFromDirectory($directory) {
// Gets a list of possible implementing classes.
Expand Down Expand Up @@ -166,6 +169,30 @@ class Updater {
return backdrop_basename($directory);
}

/**
* Return the project type from a Backdrop info file.
*
* @param string $directory
* Directory to search for the info file.
*
* @return string
* The type of the project, either "module", "theme", or "layout".
*
* @throws UpdaterException
*/
public static function getProjectType($directory) {
$info_file = self::findInfoFile($directory);
$info = backdrop_parse_info_file($info_file);
if (empty($info)) {
throw new UpdaterException(t('Unable to parse info file: %info_file.', array('%info_file' => $info_file)));
}
if (empty($info['type'])) {
throw new UpdaterException(t("The info file (%info_file) does not define a 'type' attribute.", array('%info_file' => $info_file)));
}

return $info['type'];
}

/**
* Return the project name from a Backdrop info file.
*
Expand All @@ -174,6 +201,8 @@ class Updater {
*
* @return string
* The title of the project.
*
* @throws UpdaterException
*/
public static function getProjectTitle($directory) {
$info_file = self::findInfoFile($directory);
Expand Down Expand Up @@ -216,6 +245,9 @@ class Updater {
*
* @return array
* An array of links which the user may need to complete the update
*
* @throws UpdaterException
* @throws UpdaterFileTransferException
*/
public function update(&$filetransfer, $overrides = array()) {
try {
Expand All @@ -224,7 +256,7 @@ class Updater {

// Take a Backup.
if ($args['make_backup']) {
$this->makeBackup($args['install_dir'], $args['backup_dir']);
$this->makeBackup($filetransfer, $args['install_dir'], $args['backup_dir']);
}

if (!$this->name) {
Expand Down Expand Up @@ -271,6 +303,8 @@ class Updater {
*
* @return array
* An array of links which the user may need to complete the install.
*
* @throws UpdaterFileTransferException
*/
public function install(&$filetransfer, $overrides = array()) {
try {
Expand Down Expand Up @@ -304,6 +338,8 @@ class Updater {
* Object which is a child of FileTransfer.
* @param string $directory
* The installation directory to prepare.
*
* @throws UpdaterException
*/
public function prepareInstallDirectory(&$filetransfer, $directory) {
// Make the parent dir writable if need be and create the dir.
Expand Down
2 changes: 1 addition & 1 deletion core/modules/admin_bar/tests/admin_bar.test
Expand Up @@ -383,7 +383,7 @@ class AdminBarLinkTypesTestCase extends AdminBarWebTestCase {
));

// Verify that MENU_LOCAL_TASKs appear.
$this->assertLinkTrailByTitle(array(t('Functionality'), t('Uninstall')));
$this->assertLinkTrailByTitle(array(t('Functionality'), t('Uninstall modules')));

// Verify that MENU_LOCAL_ACTIONs appear.
$this->assertLinkTrailByTitle(array(
Expand Down
2 changes: 1 addition & 1 deletion core/modules/installer/config/installer.settings.json
@@ -1,6 +1,6 @@
{
"_config_name": "installer.settings",
"installer_browser_server": {
"installer_server": {
"url": "https://projects.backdropcms.org",
"name": "Backdrop"
}
Expand Down

1 comment on commit d932498

@backdrop-ci
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.