partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

WebserverLogTest.js (1745B)


      1 /**
      2  * Tests if the web server can handle pathInfo
      3  */
      4 Ext.define('PartKeeprSetup.WebserverLogDirectoryTest', {
      5     extend: 'PartKeeprSetup.AbstractTest',
      6     url: '../../app/logs/ignore.json',
      7     method: 'GET',
      8     name: "PHP",
      9     message: "app/logs access check",
     10     onSuccess: function (response) {
     11         try {
     12             var responseObj = Ext.decode(response.responseText);
     13         } catch (e) {
     14             var responseObj = {};
     15         }
     16 
     17         if (responseObj.message && responseObj.message === "readable") {
     18             this.success = false;
     19             this.resultMessage = "Web Server misconfiguration";
     20             this.errors = ['Your <code>app/logs</code> directory is readable. Please either move your web server\'s document root to the web/ directory or configure <code>app/logs</code> to disallow access. For further information please read <a href="https://wiki.partkeepr.org/wiki/KB00007:Prevent_Access_to_the_logs_directory" target="_blank">wiki about how to prevent access to the logs directory</a>'];
     21 
     22             if (this.callback) {
     23                 this.callback.appendTestResult(this);
     24             }
     25 
     26             if (this.success) {
     27                 this.fireEvent("complete", this);
     28             }
     29         } else {
     30             this.onFailure();
     31         }
     32     },
     33     /**
     34      * This method is being called when a 404 or 500 error is returned - which indicates that the logs directory is
     35      * not readable.
     36      */
     37     onFailure: function () {
     38         this.success = true;
     39         this.resultMessage = "app/logs not readable";
     40 
     41         if (this.callback) {
     42             this.callback.appendTestResult(this);
     43         }
     44 
     45         if (this.success) {
     46             this.fireEvent("complete", this);
     47         }
     48 
     49 
     50     }
     51 });