cleanOrphanFiles(); //Clean orphaned files once per week to ensure the installation is clean. $failed_requirment_requirements = $install_obj->getFailedRequirements( false, [ 'base_url', 'clean_cache', 'file_checksums' ] ); if ( is_array( $failed_requirment_requirements ) && count( $failed_requirment_requirements ) > 1 ) { SystemSettingFactory::setSystemSetting( 'valid_install_requirements', 0 ); //sends notification for invalid install requirments SystemSettingFactory::checkValidInstallRequirments( $failed_requirment_requirements ); Debug::Text( 'Failed system requirements: ' . implode( '', $failed_requirment_requirements ), __FILE__, __LINE__, __METHOD__, 10 ); TTLog::addEntry( 0, 510, 'Failed system requirements: ' . implode( '', $failed_requirment_requirements ), 0, 'company' ); } else { SystemSettingFactory::setSystemSetting( 'valid_install_requirements', 1 ); } unset( $install_obj, $check_all_requirements ); Debug::Text( 'Checking system requirements complete... ' . TTDate::getDate( 'DATE+TIME', time() ), __FILE__, __LINE__, __METHOD__, 10 ); } // // Purge database tables // if ( !isset( $config_vars['other']['disable_database_purging'] ) || isset( $config_vars['other']['disable_database_purging'] ) && $config_vars['other']['disable_database_purging'] != true ) { PurgeDatabase::Execute(); } //Ensure we aren't running this maintenance when installer is running or we are down for maintenance. // Even though cron jobs don't run when this is the case, its possible that this mode is entered during a long running job. if ( ( isset( $config_vars['other']['installer_enabled'] ) && $config_vars['other']['installer_enabled'] == false ) && ( !isset( $config_vars['other']['down_for_maintenance'] ) || isset( $config_vars['other']['down_for_maintenance'] ) && $config_vars['other']['down_for_maintenance'] == '' ) ) { // // Clean cache directories // - Make sure cache directory is set, and log/storage directories are not contained within it. // if ( !isset( $config_vars['other']['disable_cache_purging'] ) || isset( $config_vars['other']['disable_cache_purging'] ) && $config_vars['other']['disable_cache_purging'] != true ) { if ( isset( $config_vars['cache']['dir'] ) && $config_vars['cache']['dir'] != '' && strpos( $config_vars['path']['log'], $config_vars['cache']['dir'] ) === false && strpos( $config_vars['path']['storage'], $config_vars['cache']['dir'] ) === false ) { Debug::Text( 'Purging Cache directory: ' . $config_vars['cache']['dir'] . ' - ' . TTDate::getDate( 'DATE+TIME', time() ), __FILE__, __LINE__, __METHOD__, 10 ); $install_obj = new Install(); $install_obj->cleanCacheDirectory( '\.lock|.state' ); //Don't exclude .ZIP/Upgrade Staging files, so if there is a corrupt one it will be redownloaded within a week. Debug::Text( 'Purging Cache directory complete: ' . TTDate::getDate( 'DATE+TIME', time() ), __FILE__, __LINE__, __METHOD__, 10 ); } else { Debug::Text( 'Cache directory is invalid: ' . TTDate::getDate( 'DATE+TIME', time() ), __FILE__, __LINE__, __METHOD__, 10 ); } } } // //Check for severely out of date versions and take out of production mode if necessary. // if ( PRODUCTION == true && getTTProductEdition() == TT_PRODUCT_COMMUNITY && DEPLOYMENT_ON_DEMAND == false && ( ( time() - (int)APPLICATION_VERSION_DATE ) > ( 86400 * 455 ) ) ) { Debug::Text( 'ERROR: Application version is severely out of date, changing production mode... ', __FILE__, __LINE__, __METHOD__, 10 ); $install_obj = new Install(); $tmp_config_vars['debug']['production'] = 'FALSE'; $write_config_result = $install_obj->writeConfigFile( $tmp_config_vars ); unset( $install_obj, $tmp_config_vars, $write_config_result ); } ?>