Drupal 8  8.0.2
Updater Class Reference
Inheritance diagram for Updater:

Public Member Functions

 __construct ($source, $root)
 
 update (&$filetransfer, $overrides=array())
 
 install (&$filetransfer, $overrides=array())
 
 prepareInstallDirectory (&$filetransfer, $directory)
 
 makeWorldReadable (&$filetransfer, $path, $recursive=TRUE)
 
 makeBackup (FileTransfer $filetransfer, $from, $to)
 
 getBackupDir ()
 
 postUpdate ()
 
 postInstall ()
 
 postInstallTasks ()
 
 postUpdateTasks ()
 

Static Public Member Functions

static factory ($source, $root)
 
static getUpdaterFromDirectory ($directory)
 
static findInfoFile ($directory)
 
static getProjectName ($directory)
 
static getProjectTitle ($directory)
 

Data Fields

 $source
 

Protected Member Functions

 getInstallArgs ($overrides=array())
 

Static Protected Member Functions

static getExtensionInfo ($directory)
 

Protected Attributes

 $root
 

Detailed Description

Defines the base class for Updaters used in Drupal.

Constructor & Destructor Documentation

__construct (   $source,
  $root 
)

Constructs a new updater.

Parameters
string$sourceDirectory to install from.
string$rootThe root directory under which the project will be copied to if it's a new project. Usually this is the app root (the directory in which the Drupal site is installed).

References Drupal\root().

Here is the call graph for this function:

Member Function Documentation

static factory (   $source,
  $root 
)
static

Returns an Updater of the appropriate type depending on the source.

If a directory is provided which contains a module, will return a ModuleUpdater.

Parameters
string$sourceDirectory of a Drupal project.
string$rootThe root directory under which the project will be copied to if it's a new project. Usually this is the app root (the directory in which the Drupal site is installed).
Returns
A new Drupal object.
Exceptions
\Drupal\Core\Updater\UpdaterException

References t().

Referenced by UpdateReady\submitForm(), and UpdateManagerInstall\submitForm().

Here is the call graph for this function:

Here is the caller graph for this function:

static findInfoFile (   $directory)
static

Determines what the most important (or only) info file is in a directory.

Since there is no enforcement of which info file is the project's "main" info file, this will get one with the same name as the directory, or the first one it finds. Not ideal, but needs a larger solution.

Parameters
string$directoryDirectory to search in.
Returns
string Path to the info file.

References drupal_basename(), file_scan_directory(), and Unicode\substr().

Here is the call graph for this function:

getBackupDir ( )

Returns the full path to a directory where backups should be written.

Referenced by Updater\getInstallArgs().

Here is the caller graph for this function:

static getExtensionInfo (   $directory)
staticprotected

Get Extension information from directory.

Parameters
string$directoryDirectory to search in.
Returns
array Extension info.
Exceptions
\Drupal\Core\Updater\UpdaterExceptionIf the info parser does not provide any info.

References Drupal\service(), and t().

Here is the call graph for this function:

getInstallArgs (   $overrides = array())
protected

Stores the default parameters for the Updater.

Parameters
array$overridesAn array of overrides for the default parameters.
Returns
array An array of configuration parameters for an update or install operation.

References Updater\getBackupDir().

Referenced by Updater\install(), and Updater\update().

Here is the call graph for this function:

Here is the caller graph for this function:

static getProjectName (   $directory)
static

Gets the name of the project directory (basename).

Todo:
It would be nice, if projects contained an info file which could provide their canonical name.
Parameters
string$directory
Returns
string The name of the project.

References drupal_basename().

Here is the call graph for this function:

static getProjectTitle (   $directory)
static

Returns the project name from a Drupal info file.

Parameters
string$directoryDirectory to search for the info file.
Returns
string The title of the project.
Exceptions
\Drupal\Core\Updater\UpdaterException

References Drupal\service(), and t().

Referenced by UpdateManagerInstall\submitForm(), and UpdaterTest\testGetProjectTitleWithChild().

Here is the call graph for this function:

Here is the caller graph for this function:

static getUpdaterFromDirectory (   $directory)
static

Determines which Updater class can operate on the given directory.

Parameters
string$directoryExtracted Drupal project.
Returns
string The class name which can work with this project type.
Exceptions
\Drupal\Core\Updater\UpdaterException

References t().

Referenced by UpdateUploadTest\testUpdateDirectory().

Here is the call graph for this function:

Here is the caller graph for this function:

install ( $filetransfer,
  $overrides = array() 
)

Installs a Drupal project, returns a list of next actions.

Parameters
\Drupal\Core\FileTransfer\FileTransfer$filetransferObject that is a child of FileTransfer.
array$overridesAn array of settings to override defaults; see self::getInstallArgs().
Returns
array An array of links which the user may need to complete the install.
Exceptions
\Drupal\Core\Updater\UpdaterFileTransferException

References Updater\getInstallArgs(), Updater\makeWorldReadable(), Updater\postInstall(), Updater\postInstallTasks(), Updater\prepareInstallDirectory(), and t().

Here is the call graph for this function:

makeBackup ( FileTransfer  $filetransfer,
  $from,
  $to 
)

Performs a backup.

Parameters
\Drupal\Core\FileTransfer\FileTransfer$filetransferObject which is a child of FileTransfer.
string$fromThe file path to copy from.
string$toThe file path to copy to.
Todo:
Not implemented: https://www.drupal.org/node/2474355

Referenced by Updater\update().

Here is the caller graph for this function:

makeWorldReadable ( $filetransfer,
  $path,
  $recursive = TRUE 
)

Ensures that a given directory is world readable.

Parameters
\Drupal\Core\FileTransfer\FileTransfer$filetransferObject which is a child of FileTransfer.
string$pathThe file path to make world readable.
bool$recursiveIf the chmod should be applied recursively.

Referenced by Updater\install(), Updater\prepareInstallDirectory(), and Updater\update().

Here is the caller graph for this function:

postInstall ( )

Performs actions after installation.

Referenced by Updater\install().

Here is the caller graph for this function:

postInstallTasks ( )

Returns an array of links to pages that should be visited post operation.

Returns
array Links which provide actions to take after the install is finished.

Referenced by Updater\install().

Here is the caller graph for this function:

postUpdate ( )

Performs actions after new code is updated.

Referenced by Updater\update().

Here is the caller graph for this function:

postUpdateTasks ( )

Returns an array of links to pages that should be visited post operation.

Returns
array Links which provide actions to take after the update is finished.

Referenced by Updater\update().

Here is the caller graph for this function:

prepareInstallDirectory ( $filetransfer,
  $directory 
)

Makes sure the installation parent directory exists and is writable.

Parameters
\Drupal\Core\FileTransfer\FileTransfer$filetransferObject which is a child of FileTransfer.
string$directoryThe installation directory to prepare.
Exceptions
\Drupal\Core\Updater\UpdaterException

References Updater\makeWorldReadable(), and t().

Referenced by Updater\install(), and Updater\update().

Here is the call graph for this function:

Here is the caller graph for this function:

update ( $filetransfer,
  $overrides = array() 
)

Updates a Drupal project and returns a list of next actions.

Parameters
\Drupal\Core\FileTransfer\FileTransfer$filetransferObject that is a child of FileTransfer. Used for moving files to the server.
array$overridesAn array of settings to override defaults; see self::getInstallArgs().
Returns
array An array of links which the user may need to complete the update
Exceptions
\Drupal\Core\Updater\UpdaterException
\Drupal\Core\Updater\UpdaterFileTransferException

References Updater\getInstallArgs(), Updater\makeBackup(), Updater\makeWorldReadable(), Updater\postUpdate(), Updater\postUpdateTasks(), Updater\prepareInstallDirectory(), and t().

Here is the call graph for this function:


The documentation for this class was generated from the following file: