-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
install.php
117 lines (94 loc) · 3.7 KB
/
install.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
//////////////////////////////////////////////////////////////
//////////// SOFTACULOUS REAL ESTATE LARAVEL SCRIPT ///////////
//////////////////////////////////////////////////////////////
// Script information
$softname = 'Real Estate Laravel';
$softversion = '1.0';
$softdesc = 'A Laravel-based Real Estate Management System';
$softcategory = 'CMS';
// Script Author
$softauthor = 'Your Company Name';
// Website
$softurl = 'https://your-website.com';
// Logo URL
$softlogo = 'https://your-website.com/logo.png';
// Version of PHP required
$php_version = '8.3';
// Version of MySQL required
$mysql_version = '5.7';
// Installation function
function install(){
global $softurl, $php_version, $mysql_version, $__settings, $error;
// Check PHP version
if(version_compare(PHP_VERSION, $php_version, '<')){
$error[] = 'PHP version '.$php_version.' or higher is required.';
return false;
}
// Check MySQL version
$mysql_version_installed = mysqli_get_server_info($__settings['softdb']);
if(version_compare($mysql_version_installed, $mysql_version, '<')){
$error[] = 'MySQL version '.$mysql_version.' or higher is required.';
return false;
}
// Clone the repository
if(!sclone('https://github.com/liberu-real-estate/real-estate-laravel.git', $__settings['softpath'])){
$error[] = 'Could not clone the repository.';
return false;
}
// Copy .env.example to .env
if(!copy($__settings['softpath'].'.env.example', $__settings['softpath'].'.env')){
$error[] = 'Could not copy .env.example to .env';
return false;
}
// Update .env file with database credentials
$env_file = $__settings['softpath'].'.env';
$env_content = file_get_contents($env_file);
$env_content = str_replace('DB_DATABASE=laravel', 'DB_DATABASE='.$__settings['softdb'], $env_content);
$env_content = str_replace('DB_USERNAME=root', 'DB_USERNAME='.$__settings['softdbuser'], $env_content);
$env_content = str_replace('DB_PASSWORD=', 'DB_PASSWORD='.$__settings['softdbpass'], $env_content);
file_put_contents($env_file, $env_content);
// Install Composer dependencies
if(!scomposer('install --no-dev', $__settings['softpath'])){
$error[] = 'Could not install Composer dependencies.';
return false;
}
// Install npm dependencies
if(!snpm('install', $__settings['softpath'])){
$error[] = 'Could not install npm dependencies.';
return false;
}
// Generate application key
if(!sphp('artisan key:generate', $__settings['softpath'])){
$error[] = 'Could not generate application key.';
return false;
}
// Run database migrations
if(!sphp('artisan migrate --force', $__settings['softpath'])){
$error[] = 'Could not run database migrations.';
return false;
}
// Run database seeders
if(!sphp('artisan db:seed --force', $__settings['softpath'])){
$error[] = 'Could not run database seeders.';
return false;
}
// Optimize the application
if(!sphp('artisan optimize', $__settings['softpath'])){
$error[] = 'Could not optimize the application.';
return false;
}
return true;
}
// Post-installation tasks
function post_install(){
global $__settings;
// Set up scheduled tasks
$cron_file = $__settings['softpath'].'cron.txt';
$cron_content = "* * * * * cd ".$__settings['softpath']." && php artisan schedule:run >> /dev/null 2>&1\n";
file_put_contents($cron_file, $cron_content);
echo "Installation completed successfully. Please set up the following cron job on your server:\n\n";
echo $cron_content;
echo "\nThis will ensure that scheduled tasks run properly.\n";
}
?>