-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathfresh-install.php
More file actions
41 lines (41 loc) · 1.32 KB
/
fresh-install.php
File metadata and controls
41 lines (41 loc) · 1.32 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
<?php
if (isset($_POST['install'])):
?>
<p>Fresh Install Process..</p>
<p>Droping Database <?php echo $_POST['db']; ?>..</p>
<?php
$passwd = '';
if (isset($_POST['passwd'])) {
$passwd = "-p{$_POST['passwd']}";
}
exec("mysql -uroot {$passwd} -e'drop database {$_POST['db']}'");
?>Database Dropped!
<p>Creating Database <?php echo $_POST['db']; ?>..</p>
<?php
exec("mysql -uroot {$passwd} -e'CREATE DATABASE IF NOT EXISTS `{$_POST['db']}` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci'");
?>Database Created!
<p>Migrating Database..</p>
<?php
$output = '';
exec('protected/yiic migrate', $output);
foreach ($output as $row) {
echo $row . '<br />';
}
?>
<?php
else:
?>
<form method="POST">
<fieldset>
<legend>
MySql Configuration:
</legend>
<label>HOST: <input type="text" name="host" value="localhost" /></label><br />
<label>DB: <input type="text" name="db" value="ahadpos3" /></label><br />
<label>User: <input type="text" name="user" value="root" /></label><br />
<label>Password: <input type="text" name="passwd" /></label>
</fieldset>
<input type="submit" name="install" value="Install"/>
</form>
<?php
endif;