if ($num != 1) { throw new Exception("Database query faulty response."); } // === FILESYSTEM === try { $putData = sha1(time()); file_put_contents(PIMCORE_TEMPORARY_DIRECTORY . '/check_write.tmp', $putData); $getData = file_get_contents(PIMCORE_TEMPORARY_DIRECTORY . '/check_write.tmp'); unlink(PIMCORE_TEMPORARY_DIRECTORY . '/check_write.tmp'); } catch (Exception $e) { throw new Exception('Unable to read/write a file. [' . $e->getCode() . ']'); } if ($putData !== $getData) { throw new Exception('Error writing/reading a file.'); } // === CACHE === try { Pimcore_Model_Cache::setForceImmediateWrite(true); Pimcore_Model_Cache::save($putData, $putData, array('check_write')); $getData = Pimcore_Model_Cache::load($putData); Pimcore_Model_Cache::clearTag("check_write"); } catch (Exception $e) { throw new Exception('Pimcore cache error [' . $e->getCode() . ']'); } if ($putData !== $getData) { throw new Exception('Pimcore cache failure - content mismatch.'); } echo "SUCCESS"; } catch (Exception $e) { echo "FAILURE: " . $e->getMessage(); }