Elgg  Version 1.11
upgrade.php
Go to the documentation of this file.
1 <?php
20 function elgg_set_processed_upgrades(array $processed_upgrades) {
21  $processed_upgrades = array_unique($processed_upgrades);
22  return datalist_set('processed_upgrades', serialize($processed_upgrades));
23 }
24 
35  preg_match('/^([0-9]{10})([\.a-z0-9-_]+)?\.(php)$/i', $filename, $matches);
36 
37  if (isset($matches[1])) {
38  return (int) $matches[1];
39  }
40 
41  return false;
42 }
43 
53 function elgg_get_upgrade_files($upgrade_path = null) {
54  if (!$upgrade_path) {
55  $upgrade_path = elgg_get_root_path() . 'engine/lib/upgrades/';
56  }
57  $upgrade_path = sanitise_filepath($upgrade_path);
58  $handle = opendir($upgrade_path);
59 
60  if (!$handle) {
61  return false;
62  }
63 
64  $upgrade_files = array();
65 
66  while ($upgrade_file = readdir($handle)) {
67  // make sure this is a well formed upgrade.
68  if (is_dir($upgrade_path . '$upgrade_file')) {
69  continue;
70  }
71  $upgrade_version = elgg_get_upgrade_file_version($upgrade_file);
72  if (!$upgrade_version) {
73  continue;
74  }
75  $upgrade_files[] = $upgrade_file;
76  }
77 
78  sort($upgrade_files);
79 
80  return $upgrade_files;
81 }
82 
92  delete_data("drop table {$CONFIG->dbprefix}upgrade_lock");
93  elgg_log('Upgrade unlocked.', 'NOTICE');
94 }
elgg_get_upgrade_files($upgrade_path=null)
Returns a list of upgrade files relative to the $upgrade_path dir.
Definition: upgrade.php:53
sanitise_filepath($path, $append_slash=true)
Sanitise file paths ensuring that they begin and end with slashes etc.
Definition: elgglib.php:368
delete_data($query)
Remove a row from the database.
Definition: database.php:106
global $CONFIG
datalist_set($name, $value)
Set the value for a datalist element.
elgg_get_root_path()
Get the root directory path for this installation.
elgg global
Pointer to the global context.
Definition: elgglib.js:12
elgg_set_processed_upgrades(array $processed_upgrades)
Saves the processed upgrades to a dataset.
Definition: upgrade.php:20
elgg_log($message, $level= 'NOTICE')
Display or log a message.
Definition: elgglib.php:933
elgg_get_upgrade_file_version($filename)
Returns the version of the upgrade filename.
Definition: upgrade.php:34
$filename
Definition: crop.php:23
_elgg_upgrade_unlock()
Unlocks upgrade.
Definition: upgrade.php:90