Skip to content

Commit e43e63f

Browse files
Update update.php
Added final edits to the script.
1 parent 2bf7fa9 commit e43e63f

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed
Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
11
<?php
2-
//Update Script for Updating BlogDraw from v0.0.1-alpha-2 to v0.0.1-beta-1
3-
//Changes to .htaccess
4-
echo '<h1>Starting Update...</h1>';
5-
echo '<p>Thank you for your patience.</p>';
6-
7-
//Alter Database
8-
9-
//Figure out how to alter thefunctions file
10-
11-
echo '<p>% Complete.</p>';
12-
//Changes to /Back/functions_back.php
13-
file_put_contents('../Back/functions_back.php', file_get_contents('./functions_back.php.new'));
14-
echo '<p>% Complete.</p>';
15-
//Changes to /index.php
16-
file_put_contents('../index.php', file_get_contents('./index.php.new'));
17-
echo '<p>% Complete.</p>';
18-
//Changes to /template/BlogDraw2018/index.php
19-
file_put_contents('../template/BlogDraw2018/index.php', file_get_contents('./template-blogdraw2018-index.php.new'));
20-
echo '<p>% Complete.</p>';
21-
//Changes to /template/DarkBlogDraw2018/index.php
22-
file_put_contents('../template/DarkBlogDraw2018/index.php', file_get_contents('./template-darkblogdraw2018-index.php.new'));
23-
echo '<p>% Complete.</p>';
24-
//Changes to /Uploads/1.png
25-
file_put_contents('../Uploads/1.png', file_get_contents('./1.png'));
26-
echo '<p>% Complete.</p>';
27-
//Changes to /Uploads/apple-touch-icon.png
28-
file_put_contents('../Uploads/apple-touch-icon.png', file_get_contents('./apple-touch-icon.png'));
29-
echo '<p>% Complete.</p>';
30-
//Changes to /Uploads/favicon.ico
31-
file_put_contents('../Uploads/favicon.ico', file_get_contents('./favicon.ico'));
32-
echo '<p>100% Complete.</p>';
33-
echo '<p>Done! You can now close this window.</p>
34-
<strong>It is highly recommended that you now delete the &quot;update-0-0-1-alpha-2-0-0-1-beta-1&quot; folder.</strong';
2+
//Update Script for Updating BlogDraw from v0.0.1-beta-1 to v0.0.1-beta-2
3+
echo '<h1>Starting Update...</h1>';
4+
echo '<p>Thank you for your patience.</p>';
5+
//Alter the functions file
6+
$FunctionsFile = file_get_contents('../functions.php');
7+
$FunctionsFile = explode('?><?php', $FunctionsFileData);
8+
$FunctionsFileNew = $FunctionsFileData[0] . "?>" . file_get_contents('./functions.php.new');
9+
file_put_contents('../functions.php',$FunctionsFileNew);
10+
echo '<p>11% Complete.</p>';
11+
//Alter Database
12+
require_once('../functions.php');
13+
$DBConnection = mysqli_connect($DBServer,$DBUsername,$DBPassword,$DBName);
14+
if (!$DBConnection)
15+
{
16+
die('Could not connect to database. Please try again later.');
17+
}
18+
$DBQuery = "ALTER TABLE ". $DBPrefix . "_LoginTable ADD COLUMN UserBlurb LONGTEXT,ADD COLUMN UserImage VARCHAR(255);";
19+
mysqli_query($DBConnection,$DBQuery);
20+
mysqli_close($DBConnection);
21+
echo '<p>22% Complete.</p>';
22+
//Changes to /Back/functions_back.php
23+
file_put_contents('../Back/functions_back.php', file_get_contents('./functions_back.php.new'));
24+
echo '<p>33% Complete.</p>';
25+
//Changes to /index.php
26+
file_put_contents('../index.php', file_get_contents('./index.php.new'));
27+
echo '<p>44% Complete.</p>';
28+
//Changes to /template/BlogDraw2018/index.php
29+
file_put_contents('../template/BlogDraw2018/index.php', file_get_contents('./template-blogdraw2018-index.php.new'));
30+
echo '<p>55.5% Complete.</p>';
31+
//Changes to /template/DarkBlogDraw2018/index.php
32+
file_put_contents('../template/DarkBlogDraw2018/index.php', file_get_contents('./template-darkblogdraw2018-index.php.new'));
33+
echo '<p>67% Complete.</p>';
34+
//Changes to /Uploads/1.png
35+
file_put_contents('../Uploads/1.png', file_get_contents('./1.png'));
36+
echo '<p>78% Complete.</p>';
37+
//Changes to /Uploads/apple-touch-icon.png
38+
file_put_contents('../Uploads/apple-touch-icon.png', file_get_contents('./apple-touch-icon.png'));
39+
echo '<p>89% Complete.</p>';
40+
//Changes to /Uploads/favicon.ico
41+
file_put_contents('../Uploads/favicon.ico', file_get_contents('./favicon.ico'));
42+
echo '<p>100% Complete.</p>';
43+
echo '<p>Done! You can now close this window.</p>
44+
<strong>It is highly recommended that you now delete the &quot;update-0-0-1-beta-1-0-0-1-beta-2&quot; directory.</strong';
3545
?>

0 commit comments

Comments
 (0)