-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.php
More file actions
48 lines (39 loc) · 1.14 KB
/
console.php
File metadata and controls
48 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace tFramework;
/**
* @author Lauri Turunen
* Set proper command in php client
* Create web application
* php console.php build <hostname> <dbName> <dbUser> <dbPass>
* Update database schema
* php console.php update <hostname> <dbName> <dbUser> <dbPass>
*
* Use for other console functions can be set here aswell. You can comment out the build and update functions in production environments if you wish
*
*/
if(isset($argv) && is_array($argv)){
if(isset($argv[1])){
$command=$argv[1];
}
if($command=='build' || $command=='update'){
if(isset($argv[2])
&& isset($argv[3])
&& isset($argv[4])
&& isset($argv[5])
&& isset($argv[6])){
$projectName=$argv[2];
$dbHost=$argv[3];
$dbName=$argv[4];
$dbUser=$argv[5];
$dbPass=$argv[6];
require 'project.php';
if($command=='build'){
generateHelpersAndModelsAndSqlService(true,true,true,true,'mysql',$dbHost,$dbName,$dbUser,$dbPass);
}else if($command=='update'){
generateHelpersAndModelsAndSqlService(false,true,true,false,'mysql',$dbHost,$dbName,$dbUser,$dbPass);
}
}else{
die("You need to set proper database connection");
}
}
}