/**
  * Test ac_get_log_file_path().
  *
  * @since 1.0.0
  */
 public function test_ac_get_log_file_path()
 {
     $log_dir = trailingslashit(AC_LOG_DIR);
     $hash_name = sanitize_file_name(wp_hash('unit-tests'));
     $this->assertEquals($log_dir . 'unit-tests-' . $hash_name . '.log', ac_get_log_file_path('unit-tests'));
 }
 /**
  * Remove/delete the chosen file.
  *
  * @param string $handle
  *
  * @return bool
  */
 public function remove($handle)
 {
     $removed = false;
     $file = ac_get_log_file_path($handle);
     if (is_file($file) && is_writable($file)) {
         // Close first to be certain no processes keep it alive after it is unlinked.
         $this->close($handle);
         $removed = unlink($file);
     } elseif (is_file(trailingslashit(AC_LOG_DIR) . $handle . '.log') && is_writable(trailingslashit(AC_LOG_DIR) . $handle . '.log')) {
         $this->close($handle);
         $removed = unlink(trailingslashit(AC_LOG_DIR) . $handle . '.log');
     }
     do_action('axiscomposer_log_remove', $handle, $removed);
     return $removed;
 }
Example #3
0
 public function read_content($handle)
 {
     return file_get_contents(ac_get_log_file_path($handle));
 }