@@ -185,7 +185,7 @@ public function getInstallationFolder()
185
185
*/
186
186
public function getInstallationPath ($ version )
187
187
{
188
- if ($ version === ' master ' ) {
188
+ if (' master ' === $ version ) {
189
189
$ version = $ this ->getLatestVersion ();
190
190
}
191
191
@@ -619,7 +619,7 @@ public function setRootSysDependingConfigurationPath($path)
619
619
{
620
620
$ configurationPath = $ this ->getConfigurationHelper ()->getNewConfigurationPath ($ path );
621
621
622
- if ($ configurationPath == false ) {
622
+ if (false == $ configurationPath ) {
623
623
// Seems an old installation!
624
624
$ configurationPath = $ this ->getConfigurationHelper ()->getConfigurationPath ($ path );
625
625
$ this ->setRootSys (realpath ($ configurationPath .'/../../../ ' ).'/ ' );
@@ -640,12 +640,12 @@ public function setRootSysDependingConfigurationPath($path)
640
640
*/
641
641
public function writeConfiguration ($ version , $ path , $ output )
642
642
{
643
- $ output ->writeln ("" );
644
- $ output ->writeln (" <comment>Starting the writeConfiguration process.</comment> " );
643
+ $ output ->writeln ('' );
644
+ $ output ->writeln (' <comment>Starting the writeConfiguration process.</comment> ' );
645
645
$ portalSettings = $ this ->getPortalSettings ();
646
646
$ databaseSettings = $ this ->getDatabaseSettings ();
647
647
$ configurationPath = $ this ->getConfigurationHelper ()->getConfigurationPath ($ path );
648
- $ output ->writeln (" <comment>Recovered all info. Reviewing.</comment> " );
648
+ $ output ->writeln (' <comment>Recovered all info. Reviewing.</comment> ' );
649
649
650
650
// Creates a YML File
651
651
$ configuration = [];
@@ -672,10 +672,10 @@ public function writeConfiguration($version, $path, $output)
672
672
673
673
// Version settings
674
674
$ configuration ['system_version ' ] = $ version ;
675
- $ output ->writeln (" <comment>Data reviewed. Checking where to write to...</comment> " );
675
+ $ output ->writeln (' <comment>Data reviewed. Checking where to write to...</comment> ' );
676
676
677
677
if (file_exists ($ this ->getRootSys ().'config/parameters.yml.dist ' )) {
678
- $ output ->writeln (" <comment>parameters.yml.dist file found.</comment> " );
678
+ $ output ->writeln (' <comment>parameters.yml.dist file found.</comment> ' );
679
679
680
680
$ file = $ this ->getRootSys ().'config/parameters.yml ' ;
681
681
if (!file_exists ($ file )) {
@@ -697,7 +697,7 @@ public function writeConfiguration($version, $path, $output)
697
697
}
698
698
} else {
699
699
// Try the old one
700
- $ output ->writeln (" <comment>Looking for main/install/configuration.dist.php.</comment> " );
700
+ $ output ->writeln (' <comment>Looking for main/install/configuration.dist.php.</comment> ' );
701
701
702
702
$ contents = file_get_contents ($ this ->getRootSys ().'main/install/configuration.dist.php ' );
703
703
@@ -710,18 +710,18 @@ public function writeConfiguration($version, $path, $output)
710
710
$ config ['{DATABASE_DRIVER} ' ] = $ configuration ['driver ' ];
711
711
712
712
$ config ['{COURSE_TABLE_PREFIX} ' ] = '' ;
713
- $ config ['{DATABASE_GLUE} ' ] = " `.` " ; // keeping for backward compatibility
713
+ $ config ['{DATABASE_GLUE} ' ] = ' `.` ' ; // keeping for backward compatibility
714
714
$ config ['{DATABASE_PREFIX} ' ] = '' ;
715
715
$ config ['{DATABASE_STATS} ' ] = $ configuration ['main_database ' ];
716
716
$ config ['{DATABASE_SCORM} ' ] = $ configuration ['main_database ' ];
717
717
$ config ['{DATABASE_PERSONAL} ' ] = $ configuration ['main_database ' ];
718
718
$ config ['TRACKING_ENABLED ' ] = "'true' " ;
719
- $ config ['SINGLE_DATABASE ' ] = " false " ;
719
+ $ config ['SINGLE_DATABASE ' ] = ' false ' ;
720
720
721
721
$ config ['{ROOT_WEB} ' ] = $ portalSettings ['site_url ' ];
722
722
$ config ['{ROOT_SYS} ' ] = $ this ->getRootSys ();
723
723
724
- $ config ['{URL_APPEND_PATH} ' ] = "" ;
724
+ $ config ['{URL_APPEND_PATH} ' ] = '' ;
725
725
$ config ['{SECURITY_KEY} ' ] = $ configuration ['security_key ' ];
726
726
$ config ['{ENCRYPT_PASSWORD} ' ] = $ configuration ['password_encryption ' ];
727
727
@@ -734,10 +734,10 @@ public function writeConfiguration($version, $path, $output)
734
734
}
735
735
736
736
$ newConfigurationFile = $ configurationPath .'configuration.php ' ;
737
- $ output ->writeln (sprintf (" <comment>Writing config to %s</comment> " , $ newConfigurationFile ));
737
+ $ output ->writeln (sprintf (' <comment>Writing config to %s</comment> ' , $ newConfigurationFile ));
738
738
739
739
$ result = file_put_contents ($ newConfigurationFile , $ contents );
740
- $ output ->writeln (" <comment>Config file written.</comment> " );
740
+ $ output ->writeln (' <comment>Config file written.</comment> ' );
741
741
}
742
742
743
743
return $ result ;
@@ -789,9 +789,9 @@ public function updateConfiguration(OutputInterface $output, $dryRun, $newValues
789
789
$ configurationPath = $ this ->getConfigurationPath ();
790
790
$ newConfigurationFile = $ configurationPath .'configuration.php ' ;
791
791
792
- if ($ dryRun == false ) {
792
+ if (false == $ dryRun ) {
793
793
if (version_compare ($ newValues ['system_version ' ], '1.10 ' , '>= ' ) ||
794
- ($ newValues [ ' system_version ' ] == ' 1.10.x ' || $ newValues ['system_version ' ] == '1.11.x ' )
794
+ (' 1.10.x ' == $ newValues ['system_version ' ] || '1.11.x ' == $ newValues [ ' system_version ' ] )
795
795
) {
796
796
$ configurationPath = $ _configuration ['root_sys ' ].'app/config/ ' ;
797
797
$ newConfigurationFile = $ configurationPath .'configuration.php ' ;
@@ -919,6 +919,7 @@ public function removeFiles($files, OutputInterface $output)
919
919
}
920
920
921
921
$ fs = new Filesystem ();
922
+
922
923
try {
923
924
if ($ dryRun ) {
924
925
$ output ->writeln ('<comment>Files to be removed (--dry-run is on).</comment> ' );
@@ -969,20 +970,24 @@ public function getPackage(OutputInterface $output, $version, $updateInstallatio
969
970
970
971
// Download the chamilo package from from github:
971
972
if (empty ($ updateInstallation )) {
972
- $ updateInstallation = " https://github.com/chamilo/chamilo-lms/archive/v " .$ version ." .zip " ;
973
+ $ updateInstallation = ' https://github.com/chamilo/chamilo-lms/archive/v ' .$ version .' .zip ' ;
973
974
974
975
switch ($ version ) {
975
976
case 'master ' :
976
- $ updateInstallation = "https://github.com/chamilo/chamilo-lms/archive/master.zip " ;
977
+ $ updateInstallation = 'https://github.com/chamilo/chamilo-lms/archive/master.zip ' ;
978
+
977
979
break ;
978
980
case '1.9.x ' :
979
- $ updateInstallation = "https://github.com/chamilo/chamilo-lms/archive/1.9.x.zip " ;
981
+ $ updateInstallation = 'https://github.com/chamilo/chamilo-lms/archive/1.9.x.zip ' ;
982
+
980
983
break ;
981
984
case '1.10.x ' :
982
- $ updateInstallation = "https://github.com/chamilo/chamilo-lms/archive/1.10.x.zip " ;
985
+ $ updateInstallation = 'https://github.com/chamilo/chamilo-lms/archive/1.10.x.zip ' ;
986
+
983
987
break ;
984
988
case '1.11.x ' :
985
- $ updateInstallation = "https://github.com/chamilo/chamilo-lms/archive/1.11.x.zip " ;
989
+ $ updateInstallation = 'https://github.com/chamilo/chamilo-lms/archive/1.11.x.zip ' ;
990
+
986
991
break ;
987
992
}
988
993
}
@@ -998,7 +1003,7 @@ public function getPackage(OutputInterface $output, $version, $updateInstallatio
998
1003
}
999
1004
1000
1005
// Download file?
1001
- if (strpos ($ updateInstallation , 'http ' ) === false ) {
1006
+ if (false === strpos ($ updateInstallation , 'http ' )) {
1002
1007
if (!file_exists ($ updateInstallation )) {
1003
1008
$ output ->writeln ("<comment>File does not exists: $ updateInstallation</comment> " );
1004
1009
@@ -1012,14 +1017,14 @@ public function getPackage(OutputInterface $output, $version, $updateInstallatio
1012
1017
$ output ->writeln ("<comment>Executing</comment> <info>wget -O $ updateInstallationLocalName ' $ updateInstallation'</info> " );
1013
1018
$ output ->writeln ('' );
1014
1019
1015
- $ execute = " wget -O " .$ updateInstallationLocalName ." ' $ updateInstallation' \n" ;
1020
+ $ execute = ' wget -O ' .$ updateInstallationLocalName ." ' $ updateInstallation' \n" ;
1016
1021
1017
1022
$ systemOutput = shell_exec ($ execute );
1018
1023
1019
1024
$ systemOutput = str_replace ("\n" , "\n\t" , $ systemOutput );
1020
1025
$ output ->writeln ($ systemOutput );
1021
1026
} else {
1022
- $ output ->writeln (" <comment>Seems that the chamilo v " .$ version ." has been already downloaded. File location:</comment> <info> $ updateInstallationLocalName</info> " );
1027
+ $ output ->writeln (' <comment>Seems that the chamilo v ' .$ version ." has been already downloaded. File location:</comment> <info> $ updateInstallationLocalName</info> " );
1023
1028
}
1024
1029
1025
1030
$ updateInstallation = $ updateInstallationLocalName ;
@@ -1044,7 +1049,7 @@ public function getPackage(OutputInterface $output, $version, $updateInstallatio
1044
1049
// Load from cache
1045
1050
$ chamiloPath = $ folderPath .'/chamilo-lms-CHAMILO_ ' .$ versionTag .'_STABLE/main/inc/global.inc.php ' ;
1046
1051
if (file_exists ($ chamiloPath )) {
1047
- $ output ->writeln (" <comment>Files have been already extracted here: </comment><info> " .$ folderPath .'/chamilo-lms-CHAMILO_ ' .$ versionTag .'_STABLE/ ' ." </info> " );
1052
+ $ output ->writeln (' <comment>Files have been already extracted here: </comment><info> ' .$ folderPath .'/chamilo-lms-CHAMILO_ ' .$ versionTag .'_STABLE/ ' .' </info> ' );
1048
1053
1049
1054
return $ folderPath .'/chamilo-lms-CHAMILO_ ' .$ versionTag .'_STABLE/ ' ;
1050
1055
}
@@ -1061,12 +1066,13 @@ public function getPackage(OutputInterface $output, $version, $updateInstallatio
1061
1066
/** @var \SplFileInfo $file */
1062
1067
foreach ($ files as $ file ) {
1063
1068
$ chamiloLocationPath = $ file ->getRealPath ();
1069
+
1064
1070
break ;
1065
1071
}
1066
1072
}
1067
1073
1068
1074
if (empty ($ chamiloLocationPath )) {
1069
- $ output ->writeln (" <error>Chamilo folder structure not found in package.</error> " );
1075
+ $ output ->writeln (' <error>Chamilo folder structure not found in package.</error> ' );
1070
1076
1071
1077
return 0 ;
1072
1078
}
@@ -1121,20 +1127,20 @@ public function copyPackageIntoSystem(
1121
1127
}
1122
1128
1123
1129
if (empty ($ chamiloLocationPath )) {
1124
- $ output ->writeln (" <error>The chamiloLocationPath variable is empty<error> " );
1130
+ $ output ->writeln (' <error>The chamiloLocationPath variable is empty<error> ' );
1125
1131
1126
1132
return 0 ;
1127
1133
}
1128
1134
1129
- $ output ->writeln ("<comment>Copying files from </comment><info> $ chamiloLocationPath</info><comment> to </comment><info> " .$ destinationPath ." </info> " );
1135
+ $ output ->writeln ("<comment>Copying files from </comment><info> $ chamiloLocationPath</info><comment> to </comment><info> " .$ destinationPath .' </info> ' );
1130
1136
1131
1137
if (empty ($ destinationPath )) {
1132
- $ output ->writeln (" <error>The root path was not set.<error> " );
1138
+ $ output ->writeln (' <error>The root path was not set.<error> ' );
1133
1139
1134
1140
return 0 ;
1135
1141
} else {
1136
1142
$ fileSystem ->mirror ($ chamiloLocationPath , $ destinationPath , null , ['override ' => true ]);
1137
- $ output ->writeln (" <comment>Copy finished.<comment> " );
1143
+ $ output ->writeln (' <comment>Copy finished.<comment> ' );
1138
1144
1139
1145
return 1 ;
1140
1146
}
@@ -1207,13 +1213,13 @@ public function copyConfigFilesToNewLocation(OutputInterface $output)
1207
1213
$ configFile = str_replace ('dist. ' , '' , $ file );
1208
1214
1209
1215
if (file_exists ($ confDir .$ configFile )) {
1210
- $ output ->writeln (" <comment> Moving file from: </comment> " .$ confDir .$ configFile );
1211
- $ output ->writeln (" <comment> to: </comment> " .$ configurationPath .$ configFile );
1216
+ $ output ->writeln (' <comment> Moving file from: </comment> ' .$ confDir .$ configFile );
1217
+ $ output ->writeln (' <comment> to: </comment> ' .$ configurationPath .$ configFile );
1212
1218
if (!file_exists ($ configurationPath .$ configFile )) {
1213
1219
$ fs ->copy ($ confDir .$ configFile , $ configurationPath .$ configFile );
1214
1220
}
1215
1221
} else {
1216
- $ output ->writeln (" <comment> File not found: </comment> " .$ confDir .$ configFile );
1222
+ $ output ->writeln (' <comment> File not found: </comment> ' .$ confDir .$ configFile );
1217
1223
}
1218
1224
}
1219
1225
@@ -1473,12 +1479,12 @@ protected function setConnections($version, $path, $databaseList)
1473
1479
foreach ($ dbList as &$ dbInfo ) {
1474
1480
$ params = $ this ->getDatabaseSettings ();
1475
1481
1476
- if (isset ($ _configuration ['single_database ' ]) && $ _configuration ['single_database ' ] == true ) {
1482
+ if (isset ($ _configuration ['single_database ' ]) && true == $ _configuration ['single_database ' ]) {
1477
1483
$ em = \Doctrine \ORM \EntityManager::create ($ params , $ config );
1478
1484
} else {
1479
- if ($ section == ' course ' ) {
1485
+ if (' course ' == $ section ) {
1480
1486
if (version_compare ($ version , '10 ' , '<= ' )) {
1481
- if (strpos ($ dbInfo ['database ' ], '_chamilo_course_ ' ) === false ) {
1487
+ if (false === strpos ($ dbInfo ['database ' ], '_chamilo_course_ ' )) {
1482
1488
//$params['dbname'] = $params['dbname'];
1483
1489
} else {
1484
1490
$ params ['dbname ' ] = str_replace ('_chamilo_course_ ' , '' , $ dbInfo ['database ' ]);
@@ -1490,9 +1496,11 @@ protected function setConnections($version, $path, $databaseList)
1490
1496
switch ($ dbInfo ['database ' ]) {
1491
1497
case 'statistics_database ' :
1492
1498
$ databaseName = isset ($ _configuration ['statistics_database ' ]) ? $ _configuration ['statistics_database ' ] : $ databaseName ;
1499
+
1493
1500
break ;
1494
1501
case 'user_personal_database ' :
1495
1502
$ databaseName = isset ($ _configuration ['user_personal_database ' ]) ? $ _configuration ['user_personal_database ' ] : $ databaseName ;
1503
+
1496
1504
break ;
1497
1505
}
1498
1506
$ params ['dbname ' ] = $ databaseName ;
0 commit comments