* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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 dirname(__FILE__) . '/../includes/core-minimal.inc.php'; if (Preferences::fileExists() === false) { exit(1); } //BEGIN Sessions expiration $sessions = Abstract_Session::load_all(); foreach ($sessions as $session) { if (!Abstract_Session::exists($session->id)) { // avoid operation on an already deleted Session (parallel processing) continue; } if ($session->start_time != 0 && array_key_exists('timeout', $session->settings) && $session->settings['timeout'] > 0) { if ($session->start_time + $session->settings['timeout'] < time()) { Logger::info('main', '(minutely cron) Session \'' . $session->id . '\' has expired, ending...'); $session->orderDeletion(true, Session::SESSION_END_STATUS_TIMEOUT); } } if (in_array($session->status, array(Session::SESSION_STATUS_CREATING, Session::SESSION_STATUS_CREATED, Session::SESSION_STATUS_INIT, Session::SESSION_STATUS_READY))) { if ($session->start_time < time() - DEFAULT_UNUSED_SESSION_DURATION) { Logger::info('main', '(minutely cron) Session \'' . $session->id . '\' was never used, ending...'); $session->orderDeletion(true, Session::SESSION_END_STATUS_UNUSED);