translater/_install.php

35 lines
751 B
PHP
Raw Normal View History

2021-08-18 19:42:30 +00:00
<?php
2021-09-02 21:44:01 +00:00
/**
* @brief translater, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis & contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-08-18 19:42:30 +00:00
2021-08-18 22:48:47 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
2021-09-17 22:42:35 +00:00
return null;
}
2021-08-18 22:48:47 +00:00
try {
2021-09-17 22:42:35 +00:00
if (version_compare($core->getVersion($id), $this->moduleInfo($id, 'version'), '>=')) {
return null;
2021-08-18 22:48:47 +00:00
}
$t = new dcTranslater($core);
$s = $t->getDefaultSettings();
2021-09-17 22:42:35 +00:00
foreach($s as $v) {
$t->setSetting($v[0], $v[1], false);
2021-09-17 22:42:35 +00:00
}
2021-09-17 22:42:35 +00:00
$core->setVersion($id, $this->moduleInfo($id, 'version'));
2021-08-18 22:48:47 +00:00
return true;
} catch (Exception $e) {
$core->error->add($e->getMessage());
2021-08-18 19:42:30 +00:00
}
2021-08-18 22:48:47 +00:00
return false;