-
Notifications
You must be signed in to change notification settings - Fork 443
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
Self update #1097
Self update #1097
Conversation
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.
looks good, watch your install dir and your gettext
$UpgradeDir = $CRMInstallRoot."/Upgrade"; | ||
$url = $release['assets'][0]['browser_download_url']; | ||
mkdir($UpgradeDir); | ||
//file_put_contents($UpgradeDir."/".basename($url), file_get_contents($url)); |
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.
why commented out
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.
fixed
for($i = 0; $i < $zip->numFiles; $i++) | ||
{ | ||
$archivedFileName = $zip->getNameIndex($i); | ||
$targetFilename = str_replace("churchcrm/","/",$archivedFileName); |
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.
what are you trying to do here
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.
we don't want to maintain the "churchcrm" folder inside of the zip archive when we extract it.
} | ||
|
||
if($integrityCheckData->status == "failure") { | ||
array_push($tasks, $this->addTask("Application Integrity Check Failed", "/integrityCheck.json", true)); |
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.
where are you sending the user
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.
right now I'm showing them an ugly json file with details about why the integrity check failed.
This is the UI i still have to build
require 'Include/Functions.php'; | ||
|
||
// Set the page title and include HTML header | ||
$sPageTitle = "Upgrade ChurchCRM"; |
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.
gettext
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.
fixed
|
||
<div class="login-box"> | ||
<div class="login-logo"> | ||
Upgrade <b>Church</b>CRM</a> |
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.
gettext
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.
fixed
</div> | ||
<div class="login-box-body" style="display:none" id="finalPhase"> | ||
<p class="login-box-msg"><?= gettext('Step 4: Login') ?></p> | ||
<a href="Login.php?Logoff=True" class="btn btn-primary">Login to Upgraded System</a> |
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.
gettext
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.
fixed
console.log(data); | ||
var downloadButton = "<button class=\"btn btn-primary\" id=\"downloadbutton\" role=\"button\" onclick=\"javascript:downloadbutton('"+data.filename+"')\"><i class='fa fa-download'></i> "+data.filename+"</button>"; | ||
$("#backupstatus").css("color","green"); | ||
$("#backupstatus").html("Backup Complete, Ready for Download."); |
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.
gettext
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.
fixed
$("#applyUpdate").click(function(){ | ||
$.ajax({ | ||
type : 'POST', | ||
url : window.CRM.root +'/api/systemupgrade/doUpgrade', // the url where we want to POST |
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.
not sure rest API has case
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.
fixed
|
||
$app->group('/systemupgrade', function () { | ||
|
||
$this->get('/downloadLatestRelease', function () { |
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.
all lower case or -
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.
fixed
echo json_encode($upgradeFile); | ||
}); | ||
|
||
$this->post('/doUpgrade', function ($request, $response, $args) { |
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.
same
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.
fixed
how do you test this ;) |
That's a very good question. I think there's a small glitch in the Using this bug, you can upgrade your dev environment (2.3.0) to the latest release (2.2.3). You should be able to just follow the prompts. After it's complete, you should have a completely broken system, since downgrading the app is not supported :-) |
|
||
//Set the page title | ||
$sPageTitle = gettext('Integrity Check Results'); | ||
if (!$_SESSION['bFinance']) |
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 don't get this check
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.
Whooopss.. That's what i get for copying / pasting a page. I should get rid of the header too...
exit; | ||
} | ||
require 'Include/Header.php'; | ||
$CRMInstallRoot = __DIR__; |
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.
no need for the var
?> | ||
|
||
<div class="box box-body"> | ||
<p><?= gettext("Previous Integrity Check Result:") ?> |
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.
use the callout warning css to get read or green
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.
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.
fixed in a commit coming soon to a Repo near you
$diff = $previous->diff($now); // calculate the difference. | ||
if (!$sLastIntegrityCheckTimeStamp || $diff->h >= $sIntegrityCheckInterval) // if there was no previous backup, or if the interval suggests we do a backup now. | ||
{ | ||
$CRMInstallRoot = dirname(__DIR__); |
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.
temp var not used else where
(1043, 'sQBDTSettings', @JSONV , 'json', @JSONV , 'QuickBooks Deposit Ticket Settings', 'ChurchInfoReport', 'Step7', NULL), | ||
(1044, 'sEnableIntegrityCheck', '1', 'boolean', '1', 'Enable Integrity Check', 'General', "Step5", NULL), | ||
(1045, 'sIntegrityCheckInterval', '1', 'Text', '1', 'Interval in Hours for Integrity Check', 'General', "Step5", NULL), | ||
(1046, 'sLastIntegrityCheckTimeStamp', '', 'Text', '', 'Last Integrity Check Timestamp', 'General', "Step5", NULL); |
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.
why not timestamp type?
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.
We don't have a "timestamp" type available as a type in this context.
These are not SQL column types, but rather types enumerated in lines 185-221 of SystemSettings.php
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.
we can track this separately, as there are a few other places where we may want to use a TimeStamp
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.
Tracking this in #1140
(1043, 'sQBDTSettings', @JSONV , 'json', @JSONV , 'QuickBooks Deposit Ticket Settings', 'ChurchInfoReport', 'Step7', NULL); | ||
(1043, 'sQBDTSettings', @JSONV , 'json', @JSONV , 'QuickBooks Deposit Ticket Settings', 'ChurchInfoReport', 'Step7', NULL), | ||
(1044, 'sEnableIntegrityCheck', '1', 'boolean', '1', 'Enable Integrity Check', 'General', "Step5", NULL), | ||
(1045, 'sIntegrityCheckInterval', '1', 'Text', '1', 'Interval in Hours for Integrity Check', 'General', "Step5", NULL), |
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.
1hr is too fast... 1 day or 1 week... i lean to 1 week... maybe a drop down of options
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.
for MVP, let's stick with "hours" as the unit. We can make it like 24, 48, or 168
Clicking "Fetch Update Files" needs a spinner or something... i was not sure what was going on... |
<li><? gettext("Full Path:")?> <span id="updateFullPath"> </span></li> | ||
<li><? gettext("SHA1:")?> <span id="updateSHA1"> </span></li> | ||
</ul> | ||
<input type="button" class="btn btn-warning" id="applyUpdate" <?= 'value="' . gettext("Apply Update Files") . '"' ?>> |
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.
This should be called.... upgrade system
<li><? gettext("Full Path:")?> <span id="updateFullPath"> </span></li> | ||
<li><? gettext("SHA1:")?> <span id="updateSHA1"> </span></li> | ||
</ul> | ||
<input type="button" class="btn btn-warning" id="applyUpdate" <?= 'value="' . gettext("Apply Update Files") . '"' ?>> |
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.
why is "value" in php echo tag
$this->post('/doupgrade', function ($request, $response, $args) { | ||
$input = (object)$request->getParsedBody(); | ||
$upgradeResult = $this->SystemService->doUpgrade($input->fullPath,$input->sha1); | ||
echo json_encode($upgradeResult); |
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.
where should we delete the zip file.
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.
it happens in SystemService doUpgrade()
address the issues above and we should be able to merge this soon |
do integrity check from setup page fix setup page theme misc fixes.
Closes Bugs:
#1139
#1123
#1013
Should help with bugs like:
#1059
#875
Might Help with:
#524
Probably not quite ready for prime time, but I'd like to have it in 2.3.0
This adds capability for ChurchCRM to update itself from the latest github release.
It also adds signature verification for all source files in the project.
during Phing build, generateSignatures.php create a "signatures.json" file with a sha1 of every php and js file in the project.
at runtime, the system service will periodically call verifyApplicationIntegrity() to ensure that the files installed match the signature definition file that was generated at build.
If there are errors, then integrityCheck.json will cause the TaskService to display an alert that there are possibly corrupt files.