Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Commit

Permalink
Clean up code formatting
Browse files Browse the repository at this point in the history
- Standardize use of ' and " to just "
- Standardize spaces in block declerations and function calls
- Standardize indentation & line breaks
- Line up variable values
- Remove closing PHP tag, to match config.sample.php
  • Loading branch information
JacobDB committed Apr 25, 2017
1 parent fbb991d commit fe0de6a
Showing 1 changed file with 37 additions and 38 deletions.
75 changes: 37 additions & 38 deletions deploy.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
<?php
require_once("config.php");

require_once ('config.php');
$content = file_get_contents("php://input");
$json = json_decode($content, true);
$file = fopen(LOGFILE, "a");
$time = time();

$content = file_get_contents('php://input');
$json = json_decode($content, true);
$file = fopen(LOGFILE, "a"); // Name for you Log File
$time = time();
date_default_timezone_set("UTC");
fputs($file, date("d-m-Y (H:i:s)", $time) . "\n");

date_default_timezone_set('UTC');
fputs($file, date("d-m-Y (H:i:s)",$time) . "\n");
if (!isset($_GET["token"]) || $_GET["token"] !== TOKEN) {
header("HTTP/1.0 403 Forbidden");
fputs($file, "Access Denied" . "\n");
exit;
} else {
if ($json["ref"] == BRANCH) {
fputs($file, $content . PHP_EOL);

if (!isset($_GET['token']) || $_GET['token'] !== TOKEN) {
header('HTTP/1.0 403 Forbidden');
fputs($file, "Access Denied" . "\n");
exit;
}else{
if($json['ref'] == BRANCH){
fputs($file, $content . PHP_EOL);
if (file_exists(DIR.'.git') && is_dir(DIR)) {
try{
chdir(DIR);
shell_exec(GIT . ' pull');
if (!empty(AFTER_PULL)) {
try{
shell_exec(AFTER_PULL);
}catch (Exception $e) {
fputs($file, $e . "\n");
}
}
fputs($file, "*** AUTO PULL SUCCESFUL ***" . "\n");
}catch (Exception $e) {
fputs($file, $e . "\n");
}
}
else {
fputs($file, "DIR Not Found" . "\n");
}
}
else{
fputs($file, "Push in: " . $json['ref'] . "\n");
}
if (file_exists(DIR . ".git") && is_dir(DIR)) {
try {
chdir(DIR);
shell_exec(GIT . " pull");

if (!empty(AFTER_PULL)) {
try {
shell_exec(AFTER_PULL);
} catch (Exception $e) {
fputs($file, $e . "\n");
}
}

fputs($file, "*** AUTO PULL SUCCESFUL ***" . "\n");
} catch (Exception $e) {
fputs($file, $e . "\n");
}
} else {
fputs($file, "DIR Not Found" . "\n");
}
} else{
fputs($file, "Push in: " . $json["ref"] . "\n");
}
}

fputs($file, "\n\n" . PHP_EOL);
fclose($file);
?>

0 comments on commit fe0de6a

Please sign in to comment.