You are here

function adserve_debug in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 adserve.inc \adserve_debug()
  2. 5 adserve.inc \adserve_debug()
  3. 6 adserve.inc \adserve_debug()
  4. 6.2 adserve.inc \adserve_debug()
  5. 7 adserve.inc \adserve_debug()

Display additional debug information.

1 call to adserve_debug()
adserve_ad in ./adserve.inc
The main adserve logic.

File

./adserve.inc, line 311
Configuration.

Code

function adserve_debug() {
  if (adserve_variable('debug')) {
    echo "Root drupal directory detected as '" . adserve_variable('root_dir') . "'.<br />\n<br />\n";
    $ad_dir = adserve_variable('ad_dir');
    $files = array(
      "{$ad_dir}/serve.php",
      "{$ad_dir}/adserve.inc",
      "{$ad_dir}/adcache.inc",
      "{$ad_dir}/ad.module",
    );
    if (adserve_variable('debug') >= 2) {
      $files = array_merge($files, array(
        "{$ad_dir}/ad.install",
      ));
    }
    if (adserve_variable('debug') >= 3) {
      $files = array_merge($files, array(
        "{$ad_dir}/image/ad_image.module",
        "{$ad_dir}/image/ad_image.install",
        "{$ad_dir}/text/ad_text.module",
        "{$ad_dir}/text/ad_text.install",
        "{$ad_dir}/embed/ad_embed.module",
        "{$ad_dir}/report/ad_report.module",
        "{$ad_dir}/notify/ad_notify.module",
        "{$ad_dir}/notify/ad_notify.install",
        "{$ad_dir}/cache/file/ad_cache_file.inc",
        "{$ad_dir}/cache/file/ad_cache_file.module",
        "{$ad_dir}/permission/ad_permission.module",
        "{$ad_dir}/weight/probability/ad_weight_probability.module",
        "{$ad_dir}/weight/probability/ad_weight_probability.inc",
      ));
    }
    foreach ($files as $file) {
      if (!file_exists($file)) {
        echo "Error: '{$file}' does not exist!<br />\n";
      }
      else {
        if (!is_readable($file)) {
          echo "Error: '{$file}' is not readable!<br />\n";
        }
        else {
          $fd = fopen($file, 'r');
          while (!feof($fd)) {
            $line = fgets($fd);
            if (substr($line, 0, 5) == "<?php") {
              continue;
            }
            else {
              echo "{$file}: {$line}<br />";
              break;
            }
          }
        }
      }
    }
    echo "<br />\n";
  }
}