myUrlHandlers/_install.php

41 lines
903 B
PHP
Raw Normal View History

2022-08-15 10:52:22 +00:00
<?php
2022-11-26 22:43:34 +00:00
/**
* @brief myUrlHandlers, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Alex Pirine and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
2022-08-15 10:52:22 +00:00
2022-11-26 22:43:34 +00:00
$label = basename(__DIR__);
$new_version = dcCore::app()->plugins->moduleInfo($label, 'version');
2022-08-15 10:52:22 +00:00
2022-11-26 22:43:34 +00:00
if (version_compare(dcCore::app()->getVersion($label), $new_version, '>=')) {
2022-08-15 10:52:22 +00:00
return;
}
2022-11-26 22:43:34 +00:00
try {
dcCore::app()->blog->settings->addNamespace('myurlhandlers');
dcCore::app()->blog->settings->myurlhandlers->put(
'url_handlers',
'',
'string',
'Personalized URL handlers',
false
);
dcCore::app()->setVersion($label, $new_version);
return true;
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
}
2022-08-15 10:52:22 +00:00
2022-11-26 22:43:34 +00:00
return false;