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
This commit is contained in:
Pepijn Over 2014-03-18 20:26:01 +01:00
parent b097ef2a46
commit 378e7037f0
5 changed files with 28 additions and 36 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
.gitignore export-ignore
.gitattributes export-ignore
Makefile export-ignore

18
Makefile Executable file
View File

@ -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 '

View File

@ -1,34 +1,7 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Pepijn Over <pep@neanderthal-technology.com>
* @copyright Copyright (c) 2008-2014 Pepijn Over <pep@neanderthal-technology.com>
* @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');
?>
?>

View File

@ -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 =
"<?php".PHP_EOL .
"define('PSM_CONFIG', true);".PHP_EOL;
$config = "<?php".PHP_EOL;
foreach($db_vars as $key => $value) {
$line = "define('PSM_DB_{key}', '{value}');".PHP_EOL;

View File

@ -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 {
}
?>
?>