Browse Source

Added Debian 7 support for PHP 5.5 to PHP 5.6 upgrade

bugfixes
gau1991 10 years ago
parent
commit
1f5ce003f5
  1. 26
      ee/cli/plugins/stack_upgrade.py
  2. 23
      ee/core/apt_repo.py

26
ee/cli/plugins/stack_upgrade.py

@ -52,9 +52,16 @@ class EEStackUpgradeController(CementBaseController):
# PHP 5.6 to 5.6
elif (self.app.pargs.php56):
if not os.path.isfile("/etc/apt/sources.list.d/"
"ondrej-php5-trusty.list"):
Log.error("Unable to find PHP 5.5")
if EEVariables.ee_platform_distro == "Ubuntu":
if not os.path.isfile("/etc/apt/sources.list.d/"
"ondrej-php5-trusty.list"):
Log.error("Unable to find PHP 5.5")
else:
if not(os.path.isfile(EEVariables.ee_repo_file_path) and
EEFileUtils.grep(self, EEVariables.ee_repo_file_path,
"php55")):
Log.error("Unable to find PHP 5.5")
Log.info(self, "During PHP update process non nginx-cached"
" parts of your site may remain down")
@ -63,9 +70,16 @@ class EEStackUpgradeController(CementBaseController):
start_upgrade = input("Do you want to continue:[y/N]")
if start_upgrade != "Y" and start_upgrade != "y":
Log.error(self, "Not starting PHP package update")
EEFileUtils.remove(self, ['/etc/apt/sources.list.d/'
'ondrej-php5-trusty.list'])
EERepo.add(self, ppa=EEVariables.ee_php_repo)
if EEVariables.ee_platform_distro == "Ubuntu":
EERepo.remove(self, ppa="ppa:ondrej/php5")
EERepo.add(self, ppa=EEVariables.ee_php_repo)
else:
EERepo.remove(self, repo_url="deb http://packages.dotdeb.org "
"{0}-php55 all"
.format(EEVariables.ee_platform_codename))
EERepo.add(self, repo_url=EEVariables.ee_php_repo)
Log.info(self, "Updating apt-cache, please wait...")
EEAptGet.update(self)
Log.info(self, "Installing packages, please wait ...")

23
ee/core/apt_repo.py

@ -54,16 +54,31 @@ class EERepo():
"'{ppa_name}'"
.format(ppa_name=ppa))
def remove(self, ppa=None):
def remove(self, ppa=None, repo_url=None):
"""
This function used to remove ppa's
If ppa is provided adds repo file to
/etc/apt/sources.list.d/
command.
"""
EEShellExec.cmd_exec(self, "add-apt-repository -y "
"--remove '{ppa_name}'"
.format(ppa_name=repo_url))
if ppa:
EEShellExec.cmd_exec(self, "add-apt-repository -y "
"--remove '{ppa_name}'"
.format(ppa_name=repo_url))
elif repo_url:
repo_file_path = ("/etc/apt/sources.list.d/"
+ EEVariables().ee_repo_file)
try:
repofile = open(path_to_file, "w+")
repofile.write(repofile.read().replace(repo_url, ""))
repofile.close()
except IOError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "File I/O error.")
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to remove repo")
def add_key(self, keyids, keyserver=None):
"""

Loading…
Cancel
Save