Преглед на файлове

Git force branch, git force install branch

Cerothen преди 9 години
родител
ревизия
ebd81eea69
променени са 10 файла, в които са добавени 67 реда и са изтрити 22 реда
  1. 6 1
      ajax.php
  2. 5 4
      functions.php
  3. 7 2
      lang/de.ini
  4. 4 2
      lang/en.ini
  5. 7 2
      lang/es.ini
  6. 7 2
      lang/fr.ini
  7. 7 2
      lang/it.ini
  8. 7 2
      lang/nl.ini
  9. 7 2
      lang/pl.ini
  10. 10 3
      settings.php

+ 6 - 1
ajax.php

@@ -106,7 +106,12 @@ switch ($_SERVER['REQUEST_METHOD']) {
 				break;
 			case 'upgradeInstall':
 				upgradeInstall();
-				$response['notify'] = sendNotification(true, 'Performing Checks',false);
+				$response['notify'] = sendNotification(true, 'Performing Checks', false);
+				$response['tab']['goto'] = 'updatedb.php';
+				break;
+			case 'forceBranchInstall':
+				upgradeInstall(GIT_BRANCH);
+				$response['notify'] = sendNotification(true, 'Performing Checks', false);
 				$response['tab']['goto'] = 'updatedb.php';
 				break;
 			case 'deleteLog':

+ 5 - 4
functions.php

@@ -1781,7 +1781,7 @@ function deleteDatabase() {
 }
 
 // Upgrade the installation
-function upgradeInstall() {
+function upgradeInstall($branch = 'master') {
     function downloadFile($url, $path){
         $folderPath = "upgrade/";
         if(!mkdir($folderPath)) : echo "can't make dir"; endif;
@@ -1839,10 +1839,10 @@ function upgradeInstall() {
         } else if (file_exists ( $src ))
             copy ( $src, $dst );
     }
-
-    $url = "https://github.com/causefx/Organizr/archive/master.zip";
+	
+    $url = 'https://github.com/causefx/Organizr/archive/'.$branch.'.zip';
     $file = "upgrade.zip";
-    $source = __DIR__ . "/upgrade/Organizr-master/";
+    $source = __DIR__ . '/upgrade/Organizr-'.$branch.'/';
     $cleanup = __DIR__ . "/upgrade/";
     $destination = __DIR__ . "/";
     downloadFile($url, $file);
@@ -1934,6 +1934,7 @@ function sabnzbdConnect($list = 'queue') {
 	}
 }
 
+// Apply new tab settings
 function updateTabs($tabs) {
 	if (!isset($GLOBALS['file_db'])) {
 		$GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');

+ 7 - 2
lang/de.ini

@@ -244,5 +244,10 @@ CALTIMEFORMAT = "Select time format"
 SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
 SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"
 CUSTOMHTML = "Custom HTML"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+TAB_NAME = "Tab Name"
+NEW_TAB = "New Tab"
+REMOVE = "Remove"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 4 - 2
lang/en.ini

@@ -247,5 +247,7 @@ CUSTOMHTML = "Custom HTML"
 TAB_NAME = "Tab Name"
 NEW_TAB = "New Tab"
 REMOVE = "Remove"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 7 - 2
lang/es.ini

@@ -244,5 +244,10 @@ CALTIMEFORMAT = "Select time format"
 SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
 SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"
 CUSTOMHTML = "Custom HTML"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+TAB_NAME = "Tab Name"
+NEW_TAB = "New Tab"
+REMOVE = "Remove"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 7 - 2
lang/fr.ini

@@ -244,5 +244,10 @@ CALTIMEFORMAT = "Select time format"
 SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
 SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"
 CUSTOMHTML = "Custom HTML"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+TAB_NAME = "Tab Name"
+NEW_TAB = "New Tab"
+REMOVE = "Remove"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 7 - 2
lang/it.ini

@@ -244,5 +244,10 @@ CALTIMEFORMAT = "Select time format"
 SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
 SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"
 CUSTOMHTML = "Custom HTML"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+TAB_NAME = "Tab Name"
+NEW_TAB = "New Tab"
+REMOVE = "Remove"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 7 - 2
lang/nl.ini

@@ -244,5 +244,10 @@ CALTIMEFORMAT = "Select time format"
 SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
 SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"
 CUSTOMHTML = "Custom HTML"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+TAB_NAME = "Tab Name"
+NEW_TAB = "New Tab"
+REMOVE = "Remove"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 7 - 2
lang/pl.ini

@@ -244,5 +244,10 @@ CALTIMEFORMAT = "Select time format"
 SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
 SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"
 CUSTOMHTML = "Custom HTML"
-GIT_BRANCH = "Github branch to use (Leave this alone unless you are beta testing)"
-GIT_CHECK = "Perform github lookups when settings are loaded"
+TAB_NAME = "Tab Name"
+NEW_TAB = "New Tab"
+REMOVE = "Remove"
+GIT_BRANCH = "Github branch to use when force installing (Leave this alone unless you are beta testing)"
+GIT_CHECK = "Check for new 'master' releases"
+GIT_FORCE = "Force Install Branch"
+GIT_FORCE_CONFIRM = "Are you sure you want to install this branch? Going from a newer version to an older verison is not recommended or supported."

+ 10 - 3
settings.php

@@ -1170,14 +1170,14 @@ echo buildSettings(
 						'name' => 'cookiePassword',
 						'value' => (empty(COOKIEPASSWORD)?'':randString(20)),
 					),
-					/*
 					array(
 						'type' => 'text',
 						'labelTranslate' => 'GIT_BRANCH',
+						'placeholder' => 'Default: \'master\' - Development: \'develop\' OR \'cero-dev\'',
+						'id' => 'git_branch_id',
 						'name' => 'git_branch',
 						'value' => GIT_BRANCH,
 					),
-					*/
 					array(
 						array(
 							'type' => 'checkbox',
@@ -1185,6 +1185,13 @@ echo buildSettings(
 							'name' => 'git_check',
 							'value' => GIT_CHECK,
 						),
+						array(
+							'type' => 'button',
+							'id' => 'gitForceInstall',
+							'labelTranslate' => 'GIT_FORCE',
+							'icon' => 'gear',
+							'onclick' => 'if ($(\'#git_branch_id[data-changed]\').length) { alert(\'Branch was altered, save settings first!\') } else { if (confirm(\''.translate('GIT_FORCE_CONFIRM').'\')) { ajax_request(\'POST\', \'forceBranchInstall\'); } }',
+						),
 					),
 					array(
 						'type' => 'checkbox',
@@ -2640,7 +2647,7 @@ echo buildSettings(
 					parent.notify("<strong><?php echo $language->translate("NEW_VERSION");?></strong> <?php echo $language->translate("CLICK_INFO");?>","arrow-circle-o-down","warning","50000", "<?=$notifyExplode[0];?>", "<?=$notifyExplode[1];?>");
 
 					$(infoTabNew).html("<br/><h4><strong><?php echo $language->translate("WHATS_NEW");?> " + githubVersion + "</strong></h4><strong><?php echo $language->translate("TITLE");?>: </strong>" + githubName + " <br/><strong><?php echo $language->translate("CHANGES");?>: </strong>" + githubDescription);
-					$(infoTabDownload).html("<br/><form style=\"display:initial;\" id=\"deletedb\" method=\"post\" onsubmit=\"ajax_request(\'POST\', \'upgradeInstall\'); return false;\"><input type=\"hidden\" name=\"action\" value=\"upgrade\" /><button class=\"btn waves btn-labeled btn-success text-uppercase waves-effect waves-float\" type=\"submit\"><span class=\"btn-label\"><i class=\"fa fa-refresh\"></i></span><?php echo $language->translate("AUTO_UPGRADE");?></button></form> <a href='https://github.com/causefx/Organizr/archive/<?php echo GIT_BRANCH; ?>.zip' target='_blank' type='button' class='btn waves btn-labeled btn-success text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-download'></i></span>Organizr v." + githubVersion + "</a>");
+					$(infoTabDownload).html("<br/><form style=\"display:initial;\" id=\"deletedb\" method=\"post\" onsubmit=\"ajax_request(\'POST\', \'upgradeInstall\'); return false;\"><input type=\"hidden\" name=\"action\" value=\"upgrade\" /><button class=\"btn waves btn-labeled btn-success text-uppercase waves-effect waves-float\" type=\"submit\"><span class=\"btn-label\"><i class=\"fa fa-refresh\"></i></span><?php echo $language->translate("AUTO_UPGRADE");?></button></form> <a href='https://github.com/causefx/Organizr/archive/master.zip' target='_blank' type='button' class='btn waves btn-labeled btn-success text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-download'></i></span>Organizr v." + githubVersion + "</a>");
 					$( "p[id^='upgrade']" ).toggle();
 				}else if(currentVersion === githubVersion){
 					console.log("You Are on Current Version");