From 378e7037f0d74fae0fa5a17f43e9a7cf748b59a1 Mon Sep 17 00:00:00 2001 From: Pepijn Over Date: Tue, 18 Mar 2014 20:26:01 +0100 Subject: [PATCH] adding gitattributes file for export excludes fixing call-time pass-by-reference error in Inetworx class removing header from config.php.sample and removing PSM_CONFIG constant (not really necessary) adding Makefile for easy exporting releases --- .gitattributes | 3 ++ Makefile | 18 ++++++++++++ config.php.sample | 29 +------------------ .../Controller/InstallController.class.php | 10 +++---- src/psm/Txtmsg/Inetworx.class.php | 4 +-- 5 files changed, 28 insertions(+), 36 deletions(-) create mode 100644 .gitattributes create mode 100755 Makefile diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..157364af --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +.gitignore export-ignore +.gitattributes export-ignore +Makefile export-ignore diff --git a/Makefile b/Makefile new file mode 100755 index 00000000..7b8d1ab1 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +tag = $(shell git describe) + +help: + @echo ' PHP Server Monitor - $(tag) ' + @echo ' - make export [tag=...] - create a new release from tag ' + +export: + @echo 'Building release for tag $(tag) ' + @echo 'Testing on syntax errors (thats all the automated testing your are going to get for now..) ' + find . -name "*.php" | xargs -I file php -l file + rm -rf ./build + mkdir ./build ./build/phpservermon + git archive $(tag) | tar -xf - -C ./build/phpservermon/ + find ./build/phpservermon -name "*.php" -exec sed -i "" "s/@package_version@/$(tag)/" {} \; + cd ./build; zip -rq phpservermon-$(tag).zip ./phpservermon; cd ../; + cd ./build; tar -pczf phpservermon-$(tag).tar.gz ./phpservermon; cd ../; + rm -rf ./build/phpservermon + @echo 'Building release finished ' diff --git a/config.php.sample b/config.php.sample index b36afe6d..2246f244 100755 --- a/config.php.sample +++ b/config.php.sample @@ -1,34 +1,7 @@ . - * - * @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://phpservermon.neanderthal-technology.com/ - **/ - -define('PSM_CONFIG', true); define('PSM_DB_PREFIX', 'monitor_'); define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_pass'); define('PSM_DB_NAME', 'db_name'); define('PSM_DB_HOST', 'localhost'); -?> \ No newline at end of file +?> diff --git a/src/psm/Module/Config/Controller/InstallController.class.php b/src/psm/Module/Config/Controller/InstallController.class.php index 76d1e464..f6c562ff 100755 --- a/src/psm/Module/Config/Controller/InstallController.class.php +++ b/src/psm/Module/Config/Controller/InstallController.class.php @@ -116,7 +116,7 @@ class InstallController extends AbstractController { $this->setTemplateId('install_config_new', 'install.tpl.html'); $tpl_data = array(); - if(!defined('PSM_CONFIG')) { + if(!defined('PSM_DB_PREFIX')) { // first detect "old" config file (2.0) if(file_exists($this->path_config_old)) { // oldtimer huh @@ -175,7 +175,7 @@ class InstallController extends AbstractController { } } - if(defined('PSM_CONFIG')) { + if(defined('PSM_DB_PREFIX')) { if($this->db->status()) { if($this->isUpgrade()) { // upgrade @@ -205,7 +205,7 @@ class InstallController extends AbstractController { * Execute the install and upgrade process to a newer version */ protected function executeInstall() { - if(!defined('PSM_CONFIG') || !$this->db->status()) { + if(!defined('PSM_DB_PREFIX') || !$this->db->status()) { return $this->executeConfig(); } // check if user submitted username + password in previous step @@ -281,9 +281,7 @@ class InstallController extends AbstractController { * @return boolean|string TRUE on success, string with config otherwise */ protected function writeConfigFile($db_vars) { - $config = - " $value) { $line = "define('PSM_DB_{key}', '{value}');".PHP_EOL; diff --git a/src/psm/Txtmsg/Inetworx.class.php b/src/psm/Txtmsg/Inetworx.class.php index 70de4032..2f3f7e1b 100755 --- a/src/psm/Txtmsg/Inetworx.class.php +++ b/src/psm/Txtmsg/Inetworx.class.php @@ -111,7 +111,7 @@ class Inetworx extends Core { $header .= "Content-type: application/x-www-form-urlencoded\r\n"; $header .= "Content-length: ".strlen($inarray[4])."\r\n\r\n"; // Connect to the server. - $connection = fsockopen("ssl://".$inarray[0], $inarray[1], &$errnum, &$errdesc, 10); + $connection = fsockopen("ssl://".$inarray[0], $inarray[1], $errnum, $errdesc, 10); $msg = ""; if (! $connection){ $msg = $errdesc." (".$errnum.")"; @@ -144,4 +144,4 @@ class Inetworx extends Core { } -?> \ No newline at end of file +?>