static function create_upload_directory() { //Create our folder in the "uploads" directory $upload_dir = wp_upload_dir(); $wppg_dir = $upload_dir['basedir'] . '/' . WPPG_UPLOAD_SUB_DIRNAME; if (!is_dir($wppg_dir)) { $mkdir_res = mkdir($wppg_dir, 0755, true); if ($mkdir_res === false) { $wp_photo_gallery->debug_logger->log_debug("WP_Photo_Gallery_Installer::create_upload_directory(): Could not create upload directory!", 4); return; } else { //Let's also create an empty index.html file in this folder $index_file = $wppg_dir . '/index.html'; $handle = fopen($index_file, 'w'); //or die('Cannot open file: '.$index_file); fclose($handle); } } //Let's now create a .htaccess file to protect browsing of images WP_Photo_Gallery_Installer::createGalleryHTaccessFile(); }
function do_db_upgrade_check() { if (is_admin()) { //Check if DB needs to be updated if (get_option('wp_photo_db_version') != WP_PHOTO_DB_VERSION) { include_once 'classes/wppg-photo-installer.php'; WP_Photo_Gallery_Installer::run_installer(); } } }