Commit 3f7ebbb4 authored by Penom Nom's avatar Penom Nom
Browse files

No commit message

No commit message
parent 55fd4d00
......@@ -24,7 +24,7 @@ class Install (Workflow):
def process(self):
#set typo3 variables
# Set typo3 and nG6 path variables
ng6conf = NG6ConfigReader()
[db_host, db_user, db_password, db_name] = ng6conf.get_typo3_db_params()
......@@ -38,19 +38,19 @@ class Install (Workflow):
fileadmin = os.path.join(ng6_web_path, "fileadmin")
install_tool_password ="typo3"
#Downloading typo3 package
# Downloading typo3 package
urllib.urlretrieve(self.get_resource("typo3_src"), dummy_tmp_zipfile)
#Testing and Unzipping typo3 package
# Testing and Unzipping typo3 package
with zipfile.ZipFile(dummy_tmp_zipfile, 'r') as zipf:
if zipf.testzip() is None:
zipf.extractall(dummy_tmp_dir)
#Rename typo3 folder
# Rename typo3 folder
typo3_dir = os.listdir(dummy_tmp_dir)[0]
os.rename(os.path.join(dummy_tmp_dir, typo3_dir), os.path.join(dummy_tmp_dir,ng6_web_path.split("/")[-1]))
#cp ng6 folders
# Copy nG6 folders
dirutil.copy_tree(os.path.join(ng6_path, "ui", "nG6"), os.path.join(dummy_tmp_dir, "ng6", "typo3conf", "ext", "nG6"))
os.mkdir(os.path.join(dummy_tmp_dir, "ng6", "fileadmin", "templates"))
......@@ -61,28 +61,28 @@ class Install (Workflow):
os.symlink(os.path.join(ng6conf.get_save_directory(), "data"),
os.path.join(dummy_tmp_dir, "ng6", "fileadmin", "data"))
#create config file
# Create config file
with open(os.path.join(dummy_tmp_dir, "ng6","typo3conf", "localconf.php")) as f:
config_lines= ''.join(f.readlines()[:-1])
with open(os.path.join(dummy_tmp_dir,"ng6", "typo3conf", "localconf.php"),"w") as f:
f.write(config_lines)
#Set config variables for typo3
# Set config variables for typo3 localconf.php
f.write("$TYPO3_CONF_VARS['EXT']['extList'] = 'extbase,css_styled_content,info,perm,func,filelist,fluid,about,version,tsconfig_help,context_help,extra_page_cm_options,impexp,sys_note,tstemplate,tstemplate_ceditor,tstemplate_info,tstemplate_objbrowser,tstemplate_analyzer,func_wizards,wizard_crpages,wizard_sortpages,lowlevel,install,belog,beuser,aboutmodules,setup,taskcenter,info_pagetsconfig,viewpage,rtehtmlarea,t3skin,t3editor,reports,felogin,form,rsaauth,saltedpasswords,nG6';\n")
f.write("$TYPO3_CONF_VARS['SYS']['compat_version'] = '4.7';\n")
f.write("$typo_db_username = '" + db_user + "';\n")
f.write("$typo_db_password = '" + db_password + "';\n")
f.write("$typo_db_host = '" + db_host + "';\n")
f.write("$typo_db = '" + db_name + "';\n") #Risque de conflit si utilisation de l'installeur typo3
f.write("$typo_db = '" + db_name + "';\n") # Risque de conflit si utilisation de l'installeur typo3
f.write("$TYPO3_CONF_VARS['BE']['loginSecurityLevel'] = 'rsa';\n")
f.write("$TYPO3_CONF_VARS['FE']['loginSecurityLevel'] = 'rsa';\n")
f.write("$TYPO3_CONF_VARS['EXT']['extList_FE'] = 'extbase,css_styled_content,fluid,version,install,rtehtmlarea,t3skin,felogin,form,rsaauth,saltedpasswords,nG6';\n")
f.write("$TYPO3_CONF_VARS['BE']['disable_exec_function'] = '0';\n")
f.write("$TYPO3_CONF_VARS['GFX']['gdlib_png'] = '0';\n")
f.write("$TYPO3_CONF_VARS['GFX']['im_combine_filename'] = 'composite';\n")
# Typo3 password hash
# Typo3 password hash
install_tool_password_hash = hashlib.md5(install_tool_password).hexdigest()
f.write("$TYPO3_CONF_VARS['BE']['installToolPassword'] = '" + install_tool_password_hash + "';\n")
#Testing unzip binary path :
# Testing unzip binary path :
unzip_path=["which","unzip"]
p = Popen(unzip_path, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
......@@ -93,7 +93,7 @@ class Install (Workflow):
with open(os.path.join(dummy_tmp_dir, "ng6", "typo3conf", "ENABLE_INSTALL_TOOL"), 'a'):
os.utime(os.path.join(dummy_tmp_dir, "ng6", "typo3conf", "ENABLE_INSTALL_TOOL"), None)
#Modifying database.sql
# Modifying database.sql
with open(db_path,"r") as f:
database = f.readlines()
for iline in range(0, len(database)):
......@@ -106,7 +106,8 @@ class Install (Workflow):
with open(db_path,"w") as f:
for line in database:
f.write(line)
#Creating database typo3
# Creating database typo3
mysql_create_db = ["mysql", "--host=" + db_host, "--user=" + db_user, "--password=" + db_password, "-e", "CREATE DATABASE " + db_name + ";"]
p = Popen(mysql_create_db, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
......@@ -114,7 +115,7 @@ class Install (Workflow):
sys.stderr.write(stderr)
sys.exit(0)
#Inserting tables in typo3 database
# Inserting tables in typo3 database
mysql_tables = ["mysql", "--host=" + db_host, "--user=" + db_user, "--password=" + db_password, "--default-character-set=utf8", "--database=" + db_name]
with open(db_path) as f:
query= ''.join(f.readlines())
......@@ -124,12 +125,12 @@ class Install (Workflow):
sys.stderr.write(stderr)
sys.exit(0)
# fix permissions typo3
# Fix permissions typo3 folder
for dir in [os.path.join(dummy_tmp_dir, "ng6", "typo3conf"),
os.path.join(dummy_tmp_dir,"ng6","fileadmin"),
os.path.join(dummy_tmp_dir, "ng6", "typo3temp"),
os.path.join(dummy_tmp_dir,"ng6","uploads")]:
os.chmod(dir, 0o777)
#cp typo3 folder to web folder
# Finally copy typo3 folder to web folder
dirutil.copy_tree(os.path.join(dummy_tmp_dir, ng6_path.split("/")[-1]), ng6_web_path, preserve_mode=1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment