function set_log_folders() { if (empty($this->_settings['backupBaseFolderFull'])) { return; } Snapshot_Helper_Utility::secure_folder($this->_settings['backupBaseFolderFull']); $_backupBackupFolderFull = trailingslashit($this->_settings['backupBaseFolderFull']) . '_backup'; if (!file_exists($_backupBackupFolderFull)) { /* If the destination folder does not exist try and create it */ if (wp_mkdir_p($_backupBackupFolderFull, 0775) === false) { /* If here we cannot create the folder. So report this via the admin header message and return */ $this->_admin_header_error .= __("ERROR: Cannot create snapshot Log folder. Check that the parent folder is writeable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupBackupFolderFull; return; } } /* If here the destination folder is present. But is it writeable by our process? */ if (!is_writable($_backupBackupFolderFull)) { /* Try updating the folder perms */ @chmod($_backupBackupFolderFull, 0775); if (!is_writable($_backupBackupFolderFull)) { /* Appears it is still not writeable then report this via the admin heder message and return */ $this->_admin_header_error .= __("ERROR: The Snapshot destination folder is not writable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupBackupFolderFull; } } Snapshot_Helper_Utility::secure_folder($_backupBackupFolderFull); $this->_settings['backupBackupFolderFull'] = $_backupBackupFolderFull; $_backupRestoreFolderFull = trailingslashit($this->_settings['backupBaseFolderFull']) . '_restore'; if (!file_exists($_backupRestoreFolderFull)) { /* If the destination folder does not exist try and create it */ if (wp_mkdir_p($_backupRestoreFolderFull, 0775) === false) { /* If here we cannot create the folder. So report this via the admin header message and return */ $this->_admin_header_error .= __("ERROR: Cannot create snapshot Restore folder. Check that the parent folder is writeable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupRestoreFolderFull; return; } } /* If here the destination folder is present. But is it writeable by our process? */ if (!is_writable($_backupRestoreFolderFull)) { /* Try updating the folder perms */ @chmod($_backupRestoreFolderFull, 0775); if (!is_writable($_backupRestoreFolderFull)) { /* Appears it is still not writeable then report this via the admin heder message and return */ $this->_admin_header_error .= __("ERROR: The Snapshot restore folder is not writable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupRestoreFolderFull; } } Snapshot_Helper_Utility::secure_folder($_backupRestoreFolderFull); $this->_settings['backupRestoreFolderFull'] = $_backupRestoreFolderFull; $_backupLogFolderFull = trailingslashit($this->_settings['backupBaseFolderFull']) . '_logs'; if (!file_exists($_backupLogFolderFull)) { /* If the destination folder does not exist try and create it */ if (wp_mkdir_p($_backupLogFolderFull, 0775) === false) { /* If here we cannot create the folder. So report this via the admin header message and return */ $this->_admin_header_error .= __("ERROR: Cannot create snapshot Log folder. Check that the parent folder is writeable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupLogFolderFull; return; } } /* If here the destination folder is present. But is it writeable by our process? */ if (!is_writable($_backupLogFolderFull)) { /* Try updating the folder perms */ @chmod($_backupLogFolderFull, 0775); if (!is_writable($_backupLogFolderFull)) { /* Appears it is still not writeable then report this via the admin heder message and return */ $this->_admin_header_error .= __("ERROR: The Snapshot destination folder is not writable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupLogFolderFull; } } Snapshot_Helper_Utility::secure_folder($_backupLogFolderFull); $this->_settings['backupLogFolderFull'] = $_backupLogFolderFull; // Setup our own version of _SESSION save path. This is because some servers just don't have standard PHP _SESSIONS setup properly. $_backupSessionsFolderFull = trailingslashit($this->_settings['backupLogFolderFull']) . '_sessions'; if (!file_exists($_backupSessionsFolderFull)) { /* If the destination folder does not exist try and create it */ if (wp_mkdir_p($_backupSessionsFolderFull, 0775) === false) { /* If here we cannot create the folder. So report this via the admin header message and return */ $this->_admin_header_error .= __("ERROR: Cannot create snapshot Log folder. Check that the parent folder is writeable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupSessionsFolderFull; return; } } /* If here the destination folder is present. But is it writeable by our process? */ if (!is_writable($_backupSessionsFolderFull)) { /* Try updating the folder perms */ @chmod($_backupSessionsFolderFull, 0775); if (!is_writable($_backupSessionsFolderFull)) { /* Appears it is still not writeable then report this via the admin heder message and return */ $this->_admin_header_error .= __("ERROR: The Snapshot destination folder is not writable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupSessionsFolderFull; } } Snapshot_Helper_Utility::secure_folder($_backupSessionsFolderFull); $this->_settings['backupSessionFolderFull'] = $_backupSessionsFolderFull; if ($this->config_data['config']['absoluteFolder'] != true) { //$relative_path = substr($_backupLogFolderFull, strlen(ABSPATH)); //$this->_settings['backupLogURLFull'] = site_url($relative_path); $this->_settings['backupLogURLFull'] = trailingslashit($this->_settings['backupURLFull']) . '_logs'; } else { $this->_settings['backupLogURLFull'] = ''; } /* Setup the _locks folder. Used by scheduled tasks */ $_backupLockFolderFull = trailingslashit($this->_settings['backupBaseFolderFull']) . '_locks'; if (!file_exists($_backupLockFolderFull)) { /* If the destination folder does not exist try and create it */ if (wp_mkdir_p($_backupLockFolderFull, 0775) === false) { /* If here we cannot create the folder. So report this via the admin header message and return */ $this->_admin_header_error .= __("ERROR: Cannot create snapshot Lock folder. Check that the parent folder is writeable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupLockFolderFull; return; } } /* If here the destination folder is present. But is it writeable by our process? */ if (!is_writable($_backupLockFolderFull)) { /* Try updating the folder perms */ @chmod($_backupLockFolderFull, 0775); if (!is_writable($_backupLockFolderFull)) { /* Appears it is still not writeable then report this via the admin heder message and return */ $this->_admin_header_error .= __("ERROR: The Snapshot locks folder is not writable", SNAPSHOT_I18N_DOMAIN) . " " . $_backupLockFolderFull; } } Snapshot_Helper_Utility::secure_folder($_backupLockFolderFull); $this->_settings['backupLockFolderFull'] = $_backupLockFolderFull; }