From e3dc55220ccca842b44f561c8754f89c52aadce4 Mon Sep 17 00:00:00 2001 From: Pepijn Over Date: Fri, 27 Feb 2015 11:07:11 +0100 Subject: [PATCH] fixing line endings --- docs/make.bat | 484 +++++++++--------- .../Controller/ErrorController.class.php | 112 ++-- src/psm/Module/Error/ErrorModule.class.php | 78 +-- src/psm/Util/Server/ArchiveManager.class.php | 236 ++++----- .../Archiver/ArchiverInterface.class.php | 92 ++-- .../Server/Archiver/LogsArchiver.class.php | 138 ++--- src/templates/default/main/body.tpl.html | 160 +++--- src/templates/default/main/menu.tpl.html | 42 +- .../default/module/error/401.tpl.html | 2 +- .../module/install/config_new.tpl.html | 120 ++--- .../module/install/config_new_user.tpl.html | 86 ++-- .../module/install/config_upgrade.tpl.html | 16 +- .../default/module/install/index.tpl.html | 28 +- .../default/module/install/main.tpl.html | 14 +- .../default/module/install/results.tpl.html | 22 +- .../default/module/install/success.tpl.html | 38 +- .../default/module/server/log.tpl.html | 118 ++--- .../module/server/server/list.tpl.html | 130 ++--- .../module/server/server/update.tpl.html | 210 ++++---- .../module/server/status/header.tpl.html | 6 +- .../default/module/user/login/forgot.tpl.html | 14 +- .../default/module/user/login/login.tpl.html | 24 +- .../default/module/user/login/reset.tpl.html | 18 +- .../default/module/user/profile.tpl.html | 140 ++--- .../default/module/user/user/list.tpl.html | 130 ++--- .../default/module/user/user/update.tpl.html | 162 +++--- .../default/util/module/modal.tpl.html | 28 +- .../default/util/module/sidebar.tpl.html | 50 +- static/plugin/excanvas.min.js | 4 +- .../plugin/jqplot/jqplot.canvasOverlay.min.js | 4 +- static/plugin/jqplot/jqplot.cursor.min.js | 4 +- .../jqplot/jqplot.dateAxisRenderer.min.js | 4 +- .../plugin/jqplot/jqplot.highlighter.min.js | 4 +- static/plugin/jqplot/jquery.jqplot.min.js | 4 +- 34 files changed, 1361 insertions(+), 1361 deletions(-) diff --git a/docs/make.bat b/docs/make.bat index 0f615e13..b7867255 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,242 +1,242 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. xml to make Docutils-native XML files - echo. pseudoxml to make pseudoxml-XML files for display purposes - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - - -%SPHINXBUILD% 2> nul -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\phpservermon.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\phpservermon.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdf" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf - cd %BUILDDIR%/.. - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdfja" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf-ja - cd %BUILDDIR%/.. - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -if "%1" == "xml" ( - %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The XML files are in %BUILDDIR%/xml. - goto end -) - -if "%1" == "pseudoxml" ( - %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. - goto end -) - -:end +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\phpservermon.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\phpservermon.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %BUILDDIR%/.. + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end diff --git a/src/psm/Module/Error/Controller/ErrorController.class.php b/src/psm/Module/Error/Controller/ErrorController.class.php index f4c2c061..40ab6bd1 100644 --- a/src/psm/Module/Error/Controller/ErrorController.class.php +++ b/src/psm/Module/Error/Controller/ErrorController.class.php @@ -1,56 +1,56 @@ -. - * - * @package phpservermon - * @author Pepijn Over - * @copyright Copyright (c) 2008-2014 Pepijn Over - * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 - * @version Release: @package_version@ - * @link http://www.phpservermonitor.org/ - * @since phpservermon 3.1 - **/ - -namespace psm\Module\Error\Controller; -use psm\Module\AbstractController; -use psm\Service\Database; - -class ErrorController extends AbstractController { - - function __construct(Database $db, \Twig_Environment $twig) { - parent::__construct($db, $twig); - - $this->setMinUserLevelRequired(PSM_USER_ANONYMOUS); - - $this->setActions(array( - '401', - ), '401'); - } - - /** - * 401 error page - * - * @return string - */ - protected function execute401() { - return $this->twig->render('module/error/401.tpl.html', array( - 'label_title' => psm_get_lang('error', '401_unauthorized'), - 'label_description' => psm_get_lang('error', '401_unauthorized_description'), - )); - } -} +. + * + * @package phpservermon + * @author Pepijn Over + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 3.1 + **/ + +namespace psm\Module\Error\Controller; +use psm\Module\AbstractController; +use psm\Service\Database; + +class ErrorController extends AbstractController { + + function __construct(Database $db, \Twig_Environment $twig) { + parent::__construct($db, $twig); + + $this->setMinUserLevelRequired(PSM_USER_ANONYMOUS); + + $this->setActions(array( + '401', + ), '401'); + } + + /** + * 401 error page + * + * @return string + */ + protected function execute401() { + return $this->twig->render('module/error/401.tpl.html', array( + 'label_title' => psm_get_lang('error', '401_unauthorized'), + 'label_description' => psm_get_lang('error', '401_unauthorized_description'), + )); + } +} diff --git a/src/psm/Module/Error/ErrorModule.class.php b/src/psm/Module/Error/ErrorModule.class.php index 03652230..0787b9ea 100644 --- a/src/psm/Module/Error/ErrorModule.class.php +++ b/src/psm/Module/Error/ErrorModule.class.php @@ -1,39 +1,39 @@ -. - * - * @package phpservermon - * @author Pepijn Over - * @copyright Copyright (c) 2008-2014 Pepijn Over - * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 - * @version Release: @package_version@ - * @link http://www.phpservermonitor.org/ - * @since phpservermon 3.1 - **/ - -namespace psm\Module\Error; -use psm\Module\ModuleInterface; - -class ErrorModule implements ModuleInterface { - public function getControllers() { - return array( - 'error' => __NAMESPACE__ . '\Controller\ErrorController', - ); - - } -} +. + * + * @package phpservermon + * @author Pepijn Over + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 3.1 + **/ + +namespace psm\Module\Error; +use psm\Module\ModuleInterface; + +class ErrorModule implements ModuleInterface { + public function getControllers() { + return array( + 'error' => __NAMESPACE__ . '\Controller\ErrorController', + ); + + } +} diff --git a/src/psm/Util/Server/ArchiveManager.class.php b/src/psm/Util/Server/ArchiveManager.class.php index 42da59cd..65ea650f 100644 --- a/src/psm/Util/Server/ArchiveManager.class.php +++ b/src/psm/Util/Server/ArchiveManager.class.php @@ -1,119 +1,119 @@ -. - * - * @package phpservermon - * @author Pepijn Over - * @copyright Copyright (c) 2008-2014 Pepijn Over - * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 - * @version Release: @package_version@ - * @link http://www.phpservermonitor.org/ - * @since phpservermon 3.1 - **/ - -namespace psm\Util\Server; - -/** - * Makes sure all data of servers is being archived properly or removed if necessary. - */ -class ArchiveManager { - - /** - * Available archiver utils. - * @var array $archivers - */ - protected $archivers = array(); - - /** - * Database service - * @var \psm\Service\Database $db - */ - protected $db; - - /** - * Retention period - * @var \DateInterval $retention_period - * @see setRetentionPeriod() - */ - protected $retention_period; - - public function __construct(\psm\Service\Database $db) { - $this->db = $db; - - $this->setRetentionPeriod(psm_get_conf('log_retention_period', 365)); - - $this->archivers[] = new Archiver\UptimeArchiver($db); - $this->archivers[] = new Archiver\LogsArchiver($db); - } - - /** - * Archive one or more servers. - * @param int $server_id - * @return boolean - */ - public function archive($server_id = null) { - $result = true; - foreach($this->archivers as $archiver) { - if(!$archiver->archive($server_id)) { - $result = false; - } - } - return $result; - } - - /** - * Cleanup old records for one or more servers - * @param int $server_id - * @return boolean - */ - public function cleanup($server_id = null) { - $result = true; - if(!$this->retention_period) { - // cleanup is disabled - return $result; - } - $retdate = new \DateTime(); - $retdate->sub($this->retention_period); - - foreach($this->archivers as $archiver) { - if(!$archiver->cleanup($retdate, $server_id)) { - $result = false; - } - } - return $result; - } - - /** - * Set retention period for this archive run. - * - * Set period to 0 to disable cleanup altogether. - * @param \DateInterval|int $period \DateInterval object or number of days (int) - * @return \psm\Util\Server\ArchiveManager - */ - public function setRetentionPeriod($period) { - if(is_object($period) && $period instanceof \DateInterval) { - $this->retention_period = $period; - } elseif(intval($period) == 0) { - // cleanup disabled - $this->retention_period = false; - } else { - $this->retention_period = new \DateInterval('P' . intval($period) . 'D'); - } - return $this; - } +. + * + * @package phpservermon + * @author Pepijn Over + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 3.1 + **/ + +namespace psm\Util\Server; + +/** + * Makes sure all data of servers is being archived properly or removed if necessary. + */ +class ArchiveManager { + + /** + * Available archiver utils. + * @var array $archivers + */ + protected $archivers = array(); + + /** + * Database service + * @var \psm\Service\Database $db + */ + protected $db; + + /** + * Retention period + * @var \DateInterval $retention_period + * @see setRetentionPeriod() + */ + protected $retention_period; + + public function __construct(\psm\Service\Database $db) { + $this->db = $db; + + $this->setRetentionPeriod(psm_get_conf('log_retention_period', 365)); + + $this->archivers[] = new Archiver\UptimeArchiver($db); + $this->archivers[] = new Archiver\LogsArchiver($db); + } + + /** + * Archive one or more servers. + * @param int $server_id + * @return boolean + */ + public function archive($server_id = null) { + $result = true; + foreach($this->archivers as $archiver) { + if(!$archiver->archive($server_id)) { + $result = false; + } + } + return $result; + } + + /** + * Cleanup old records for one or more servers + * @param int $server_id + * @return boolean + */ + public function cleanup($server_id = null) { + $result = true; + if(!$this->retention_period) { + // cleanup is disabled + return $result; + } + $retdate = new \DateTime(); + $retdate->sub($this->retention_period); + + foreach($this->archivers as $archiver) { + if(!$archiver->cleanup($retdate, $server_id)) { + $result = false; + } + } + return $result; + } + + /** + * Set retention period for this archive run. + * + * Set period to 0 to disable cleanup altogether. + * @param \DateInterval|int $period \DateInterval object or number of days (int) + * @return \psm\Util\Server\ArchiveManager + */ + public function setRetentionPeriod($period) { + if(is_object($period) && $period instanceof \DateInterval) { + $this->retention_period = $period; + } elseif(intval($period) == 0) { + // cleanup disabled + $this->retention_period = false; + } else { + $this->retention_period = new \DateInterval('P' . intval($period) . 'D'); + } + return $this; + } } \ No newline at end of file diff --git a/src/psm/Util/Server/Archiver/ArchiverInterface.class.php b/src/psm/Util/Server/Archiver/ArchiverInterface.class.php index 084b3f6d..dfa9b900 100644 --- a/src/psm/Util/Server/Archiver/ArchiverInterface.class.php +++ b/src/psm/Util/Server/Archiver/ArchiverInterface.class.php @@ -1,47 +1,47 @@ -. - * - * @package phpservermon - * @author Pepijn Over - * @copyright Copyright (c) 2008-2014 Pepijn Over - * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 - * @version Release: @package_version@ - * @link http://www.phpservermonitor.org/ - * @since phpservermon 3.1 - **/ - -namespace psm\Util\Server\Archiver; - -interface ArchiverInterface { - - /** - * Archive for one or all servers. - * @param int $server_id - * @return boolean - */ - public function archive($server_id = null); - - /** - * Cleanup data older than the retention period given. - * @param \DateTime $retention_date - * @param int $server_id - * @return boolean - */ - public function cleanup(\DateTime $retention_date, $server_id = null); +. + * + * @package phpservermon + * @author Pepijn Over + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 3.1 + **/ + +namespace psm\Util\Server\Archiver; + +interface ArchiverInterface { + + /** + * Archive for one or all servers. + * @param int $server_id + * @return boolean + */ + public function archive($server_id = null); + + /** + * Cleanup data older than the retention period given. + * @param \DateTime $retention_date + * @param int $server_id + * @return boolean + */ + public function cleanup(\DateTime $retention_date, $server_id = null); } \ No newline at end of file diff --git a/src/psm/Util/Server/Archiver/LogsArchiver.class.php b/src/psm/Util/Server/Archiver/LogsArchiver.class.php index c64073aa..60d25cb3 100644 --- a/src/psm/Util/Server/Archiver/LogsArchiver.class.php +++ b/src/psm/Util/Server/Archiver/LogsArchiver.class.php @@ -1,70 +1,70 @@ -. - * - * @package phpservermon - * @author Pepijn Over - * @copyright Copyright (c) 2008-2014 Pepijn Over - * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 - * @version Release: @package_version@ - * @link http://www.phpservermonitor.org/ - * @since phpservermon 3.1 - **/ - -/** - * Cleanup log table - */ -namespace psm\Util\Server\Archiver; -use psm\Service\Database; - -class LogsArchiver implements ArchiverInterface { - - /** - * Database service - * @var \psm\Service\Database $db - */ - protected $db; - - function __construct(Database $db) { - $this->db = $db; - } - - /** - * Currently there is not really a log archive. - * - * It stays in the log table until cleaned up. - * @param int $server_id - */ - public function archive($server_id = null) { - return true; - } - - public function cleanup(\DateTime $retention_date, $server_id = null) { - $sql_where_server = ($server_id !== null) - // this is obviously not the cleanest way to implement this when using paramter binding.. sorry. - ? ' `server_id` = ' . intval($server_id) . ' AND ' - : ''; - - $this->db->execute( - "DELETE FROM `".PSM_DB_PREFIX."log` WHERE {$sql_where_server} `datetime` < :latest_date", - array('latest_date' => $retention_date->format('Y-m-d 00:00:00')), - false - ); - return true; - } +. + * + * @package phpservermon + * @author Pepijn Over + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 3.1 + **/ + +/** + * Cleanup log table + */ +namespace psm\Util\Server\Archiver; +use psm\Service\Database; + +class LogsArchiver implements ArchiverInterface { + + /** + * Database service + * @var \psm\Service\Database $db + */ + protected $db; + + function __construct(Database $db) { + $this->db = $db; + } + + /** + * Currently there is not really a log archive. + * + * It stays in the log table until cleaned up. + * @param int $server_id + */ + public function archive($server_id = null) { + return true; + } + + public function cleanup(\DateTime $retention_date, $server_id = null) { + $sql_where_server = ($server_id !== null) + // this is obviously not the cleanest way to implement this when using paramter binding.. sorry. + ? ' `server_id` = ' . intval($server_id) . ' AND ' + : ''; + + $this->db->execute( + "DELETE FROM `".PSM_DB_PREFIX."log` WHERE {$sql_where_server} `datetime` < :latest_date", + array('latest_date' => $retention_date->format('Y-m-d 00:00:00')), + false + ); + return true; + } } \ No newline at end of file diff --git a/src/templates/default/main/body.tpl.html b/src/templates/default/main/body.tpl.html index 0a8c9dda..8b00ed8e 100644 --- a/src/templates/default/main/body.tpl.html +++ b/src/templates/default/main/body.tpl.html @@ -1,80 +1,80 @@ -{% block header %} - - - - - {{ title }} - - - - - - - {% if auto_refresh %} - - {% endif %} - - - - - - - - - - - - -{% endblock %} - - - - - - {{ html_modal|raw }} - -
- -
- {{ html_sidebar|raw }} -
-
- {% for msg in messages %} -
-

-

{{ msg.message }}

-
- {% endfor %} -
- {{ html_content|raw }} -
-
- {% if add_footer %} - {% block footer %} - - {% endblock %} - {% endif %} -
- - - +{% block header %} + + + + + {{ title }} + + + + + + + {% if auto_refresh %} + + {% endif %} + + + + + + + + + + + + +{% endblock %} + + + + + + {{ html_modal|raw }} + +
+ +
+ {{ html_sidebar|raw }} +
+
+ {% for msg in messages %} +
+

+

{{ msg.message }}

+
+ {% endfor %} +
+ {{ html_content|raw }} +
+
+ {% if add_footer %} + {% block footer %} + + {% endblock %} + {% endif %} +
+ + + diff --git a/src/templates/default/main/menu.tpl.html b/src/templates/default/main/menu.tpl.html index 7ffeba0c..aa6fd44c 100644 --- a/src/templates/default/main/menu.tpl.html +++ b/src/templates/default/main/menu.tpl.html @@ -1,22 +1,22 @@ -