Example #1
0
/*
 * Create the config managers.
 */
$tsm_cm = $cmf->get_config_manager('plug-ins', 'trackit-stock-management');
#/*
# * Create a lock file to prevent any more copies of this script running.
# */
#$lock_file_name = $tsm_cm->get_rffn_lock_file_name();
#
#if (!is_file($lock_file_name)) {
#	if ($fh = fopen($lock_file_name, 'w')) {
#		fwrite($fh, date('c') . "\n");
#	} else {
#		throw new Exception("Unable to open the lock file: $lock_file_name!");
#	}
$read_feed_file_names_script_lock_file = TrackitStockManagement_FeedFilesHelper::get_read_feed_file_names_script_lock_file();
if ($read_feed_file_names_script_lock_file->is_locked()) {
    throw new Exception('The read-feed-file-names script is locked!');
} else {
    $read_feed_file_names_script_lock_file->lock();
    /*
     * Create the database objects.
     */
    $mu = $muf->get_for_this_project();
    $database = $mu->get_database();
    $feed_files_table = $database->get_table('hpi_trackit_stock_management_feed_files');
    /*
     * Connect to the remote host and get a list of the files.
     */
    $ftp_server_address = $tsm_cm->get_ftp_server_address();
    #echo "\$ftp_server_address: $ftp_server_address\n";