Commit 4999f923 authored by Penny Leach's avatar Penny Leach
Browse files

ajax installer. NOT shiny yet but installing the core now works

parent 249de5ca
......@@ -25,28 +25,37 @@
*/
define('INTERNAL',1);
define('INSTALLER',1);
require(dirname(dirname(__FILE__)) . '/init.php');
$name = clean_requestdata('name',PARAM_ALPHAEXT,REQUEST_EITHER);
// todo upgrade stuff
sleep(1);
// key, success, newversion ,errormessage
$upgrade = check_upgrades($name);
$data = array(
'key' => $name,
'success' => true,
'newversion' => 0.1,
);
'key' => $name
);
if (!empty($upgrade)) {
$data['newversion'] = $upgrade->torelease . '( ' . $upgrade->to . ')' ;
if ($name == 'core') {
$funname = 'upgrade_core';
}
else {
$funname = 'upgrade_plugin';
}
try {
$funname($upgrade);
$data['success'] = 1;
}
catch (Exception $e) {
error_log(print_r($e,true));
$data['errormessage'] = $e->getMessage();
$data['success'] = 0;
}
}
else {
$data['success'] = 1;
$data['errormessage'] = get_string('nothingtoupgrade','admin');
}
echo json_encode($data);
?>
\ No newline at end of file
......@@ -24,7 +24,8 @@
*
*/
define('INTERNAL',1);
define('INTERNAL', 1);
define('INSTALLER', 1);
require(dirname(dirname(__FILE__)).'/init.php');
......
......@@ -4,4 +4,5 @@ $string['component'] = 'Component or plugin';
$string['fromversion'] = 'From version';
$string['toversion'] = 'To version';
$string['notinstalled'] = 'Not installed';
$string['nothingtoupgrade'] = 'Nothing to upgrade';
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment