-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto upgrade feature #220
base: development
Are you sure you want to change the base?
Auto upgrade feature #220
Conversation
$ok = false; | ||
$msg .= error(_("The system is already Up-to date with the version on GitHub."), true); | ||
} | ||
if($ok) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding style error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a blank line before the if($ok)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess only that's the error, or did I missed something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -6,8 +6,8 @@ | |||
# Description: | |||
# An update bash script for engelsystem | |||
|
|||
# Add upstream | |||
# Add upstream | |||
git remote add upstream http://www.github.com/fossasia/engelsystem.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you notice that "origin" is also "http://www.github.com/fossasia/engelsystem.git"?
No need to define a "remote" with the same URL as "origin".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a person Forks the project and makes some minor changes to it and uses it on his/her system, then remote would be required.
In the case of forked repositories, "remote" will be different from "origin"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If he forks the project and make somes changes, he should update from his repo, not FOSSASIA repo, because who can guarantee that new change in FOSSASIA won't break his system? The code update in FOSSASIA repo is only tested against the code in FOSSASIA repo, not against code of someone else. And who guarantee that new update from FOSSASIA won't have conflict with the change he made in his repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove "remote" and pull from "origin"
Thank you.
04803c7
to
ce8c668
Compare
Where in this PR that you run the upgrade.sql file, if that file exists? Show me the screenshot that you have tested this feature in your localhost (with and without database change) Can you explain this line: echo shell_exec("sudo sh ./update.sh"); Why Why
The path What if |
I'll remove sudo and sh.
I found this on stackoverflow.com . Will find that again and post it here |
Don't just copy and paste from stackoverflow. You have to understand what you are doing. This is not the first time I remind you to read documentation and understand the command you are using. --- Update --- |
@@ -187,12 +188,48 @@ function user_settings() { | |||
$display_message=strip_request_item('display_message'); | |||
else | |||
$ok = false; | |||
if($ok){ | |||
|
|||
if ($ok){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation error: It should be if ($ok) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. Thanks!
No The screenshots(without database change) are there shown above. |
if(strcmp($current_ver, "Version: 1.0") == 0){ | ||
$upgrade_table = '../db/upgrade_01.sql'; | ||
upgrade_tables($upgrade_table); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly we can create upgrade_XX.sql
for every release and compare the version numbers of the of the local system.
I'll add in the documentation too, how to upgrade the database(with a sample code explaining everything) so that users who'll be working on it in future can integrate the changes in the database.
Eg. If the current version in the local system is 3.0
and on GitHub it is 5.0
then in the if statement both Upgrade_04.sql
and upgrade_05.sql
will run.
Will update the documentation for the same
Now the update.sh script contains only 1 command. Let's get rid of that file. By creating upgrade_XX.sql, you are repeating the work done by the "database migration" feature. Please look for a way to reuse that feature. |
@hongquan: can we implement that as a Fix/Improvement and merge this PR? I am looking for a way to reuse that feature.
I suggest not to get rid of that file because we will require that while running the migrations. |
What is required is the commands in that file. Because it has only 1 command, you should pass that command to your
The PR is merged after it is tested to show that it is stable and not break the system. You still don't provide the screenshots to show that you have tested with update + database. It is not proved to be ready for merge yet! --- Update --- Btw, there still be whitespace error in your code. |
The Apache log: Contents of INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (45, 'install23', 'Install Engelsystem'); Tested the system for a random database upgrade. |
Will update the documentation. |
Read my #220 (comment) again:
Change in database schema. Inserting data to database is not a change in schema. |
When you get the Apache error log, did you look into it to discover error and try to fix? |
I will be working on fixing those errors, most of them are not because of this feature.
I'll test for change in schema as well |
The Apache log: content of ALTER TABLE `Room` ADD `e_id` int(11) NOT NULL; System Upgraded successfully. |
I reminded you to look into Apache error log, but you still ignore this:
Look into kamishettysreeja25 PR about "Wordpress-like installation" to learn how to prevent the other errors. And also you can merge "development" branch to your branch to update with the fix she has done. |
if(strcmp($current_ver, "Version: 1.0") == 0){
$upgrade_table = '../db/upgrade_01.sql';
upgrade_tables($upgrade_table);
} If Version.txt contains higher number, like |
I explained that in the Line comment, https://github.com/fossasia/engelsystem/pull/220/files#r75583290 I'll add that to the documentation/wiki |
Apache log: Fixed the mentioned error. the error was due to the wrong link in index.php I'll look into Kamishettysreeja PR for solving the other errors |
What? You ask user to modify source code? He/she has to find which version his/her website is, and which version the new update is, and has to implement the whole Needless to say that user doesn't know when to change, because:
|
No. not the user. User won't work on the code. |
Then how the developer know which version the local system is? Assume you are releasing v5, but Mario has a website with v4, and sister Phuc has a website with v1. How the developer implement that --- Update --- |
Issue : #162
Enable disable update in the UI
System updated to latest version
Check for updates enabled