PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/duplicator/files/log-read.php

https://bitbucket.org/zachisit/zachis.it-m
PHP | 61 lines | 44 code | 14 blank | 3 comment | 9 complexity | 3ee793fb92aab9334a22611165e48bf1 MD5 | raw file
  1. <?php
  2. /** WordPress Administration Bootstrap
  3. see: http://codex.wordpress.org/Roles_and_Capabilities#export
  4. Must be logged in from the WordPress Admin */
  5. require_once('../../../../wp-admin/admin.php');
  6. require_once('../define.php');
  7. if (! current_user_can('level_8') ) {
  8. die("You must be a WordPress Administrator to view the Duplicator logs.");
  9. }
  10. $logs = glob(DUPLICATOR_SSDIR_PATH . '/*.log') ;
  11. if (count($logs))
  12. @chmod(duplicator_safe_path($logs[0]), 0644);
  13. if (count($logs)) {
  14. @usort($logs, create_function('$a,$b', 'return filemtime($a) - filemtime($b);'));
  15. }
  16. $logname = basename($logs[0]);
  17. $logpath = DUPLICATOR_SSDIR_PATH . '/' . $logname;
  18. $logfound = (strlen($logname) > 0) ? true :false;
  19. $handle = fopen($logpath , "c+");
  20. $file = ($handle) ? fread($handle, filesize($logpath)) : "";
  21. @fclose($handle);
  22. $plugins_url = plugins_url();
  23. $admin_url = admin_url();
  24. ?>
  25. <html xmlns="http://www.w3.org/1999/xhtml">
  26. <head>
  27. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  28. <meta name="robots" content="noindex,nofollow">
  29. <link rel="stylesheet" href="<?php echo $admin_url; ?>/load-styles.php?c=0&amp;dir=ltr&amp;load=admin-bar,wp-jquery-ui-dialog,wp-admin&amp;ver=63e8d12bee407fb9bdf078f542ef8b29" type="text/css" media="all">
  30. <link rel="stylesheet" id="duplicator_style-css" href="<?php echo $plugins_url; ?>/duplicator/css/style.css?ver=3.3.2" type="text/css" media="all">
  31. </head>
  32. <body>
  33. <?php if (! $logfound || strlen($file) == 0) : ?>
  34. <div style="padding:20px">
  35. <h2><?php _e("Log file not found or unreadable", 'wpduplicator') ?>.</h2>
  36. <?php _e("The log file for the Duplicator Plugin can be found in the snapshots directory with the extension *.log", 'wpduplicator') ?>.
  37. <?php _e("If no log file is present the try to create a package", 'wpduplicator') ?>.<br/><br/>
  38. <?php _e("Reasons for log file not showing", 'wpduplicator') ?>: <br/>
  39. - <?php _e("The web server does not support returning .log file extentions", 'wpduplicator') ?>. <br/>
  40. - <?php _e("The snapshots directory does not have the correct permissions to write files. Try setting the permissions to 755", 'wpduplicator') ?>. <br/>
  41. - <?php _e("The process that PHP runs under does not have enough permissions to create files. Please contact your hosting provider for more details", 'wpduplicator') ?>. <br/>
  42. </div>
  43. <?php else: ?>
  44. <pre style="padding:5px"><?php echo $file ?></pre>
  45. <?php endif; ?>
  46. </body>
  47. </html>