Skip to content

Commit 22891dd

Browse files
committed
remove class \optimistex\deploy\GitHelper and unused files
1 parent 26aebcb commit 22891dd

File tree

4 files changed

+1
-128
lines changed

4 files changed

+1
-128
lines changed

bitbucket-webhook.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "optimistex/git-auto-deploy-ex",
3-
"version": "1.0.4.3",
3+
"version": "1.1.0.0",
44
"type": "library",
55
"description": "The little project for auto-deploying projects to a hosting",
66
"keywords": [

index.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

shell_lib.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -92,91 +92,6 @@ public static function log($message)
9292
}
9393
}
9494

95-
/**
96-
* Class for auto-deploy code through git
97-
*
98-
* Example for using:
99-
*
100-
* ```php
101-
* // Prepare config
102-
* $config = [
103-
* 'log_file' => 'log.txt',
104-
* 'project_root' => '../..',
105-
* 'key' => 'zo9t9wcuwfi6wbqvu78z9biks3l39rue',
106-
* ];
107-
*
108-
* // Run App
109-
* GitHelper::init($config);
110-
* ```
111-
*/
112-
class GitHelper
113-
{
114-
/**
115-
* @var array
116-
*/
117-
static $config;
118-
119-
/**
120-
* @param string $key unique key for protect deploying
121-
* @param string $project_root path to the project of git
122-
* @param string $log_file path to log-file
123-
*/
124-
public static function run($key, $project_root = '.', $log_file = 'git-deploy-log.txt')
125-
{
126-
static::init([
127-
'key' => $key,
128-
'project_root' => $project_root,
129-
'log_file' => $log_file,
130-
]);
131-
132-
if (file_exists($log_file)) {
133-
echo '<h1>LOG </h1><pre>';
134-
echo file_get_contents($log_file);
135-
echo '</pre>';
136-
} else {
137-
echo 'log not found';
138-
}
139-
}
140-
141-
public static function init($config)
142-
{
143-
// Conf
144-
static::$config = $config;
145-
LogHelper::init(static::$config['log_file']);
146-
147-
// Run
148-
if (static::git_check_access()) {
149-
LogHelper::log('SESSION START');
150-
LogHelper::log(ShellHelper::exec([
151-
'cd ' . static::$config['project_root'],
152-
'git branch',
153-
'git pull',
154-
]));
155-
156-
static::end();
157-
}
158-
}
159-
160-
public static function end()
161-
{
162-
LogHelper::log('SESSION END');
163-
}
164-
165-
public static function git_check_access()
166-
{
167-
if (isset($_GET['key']) && !empty($_GET['key'])) {
168-
if (static::$config['key'] === $_GET['key']) {
169-
LogHelper::log('ACCESS');
170-
return true;
171-
} else {
172-
LogHelper::log('DENY << ://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
173-
static::end();
174-
}
175-
}
176-
return false;
177-
}
178-
}
179-
18095
/**
18196
* Main class for deploying
18297
* Example for use it:

0 commit comments

Comments
 (0)