コード例 #1
0
ファイル: index.php プロジェクト: alerque/bibledit
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
// Security: The script runs from the cli SAPI only.
Filter_Cli::assert();
$database_logs = Database_Logs::getInstance();
$database_bibles = Database_Bibles::getInstance();
$database_config_bible = Database_Config_Bible::getInstance();
$bibles = $database_bibles->getBibles();
// Go through all sub directories of the exports directory.
// Remove subdirectories if their corresponding Bible no longer exists in the system.
$directory = Export_Logic::mainDirectory();
foreach (new DirectoryIterator($directory) as $fileInfo) {
    if ($fileInfo->isDot()) {
        continue;
    }
    if ($fileInfo->isDir()) {
        $bible = $fileInfo->getFilename();
        if (in_array($bible, $bibles)) {
            continue;
        }
        $path = $fileInfo->getPathname();
        Filter_Rmdir::rmdir($path);
        $database_logs->log("Removing exported Bible {$bible}", Filter_Roles::ADMIN_LEVEL);
    }
}
// Schedule the relevant Bibles for export.