Quellcode durchsuchen

pre-install ioncube

ioncube is tied to the php version and makes sense to tie this to the
app
Girish Ramakrishnan vor 6 Jahren
Ursprung
Commit
590c9122d1
3 geänderte Dateien mit 26 neuen und 1 gelöschten Zeilen
  1. 5 0
      DESCRIPTION.md
  2. 8 0
      Dockerfile
  3. 13 1
      test/test.js

+ 5 - 0
DESCRIPTION.md

@@ -13,6 +13,11 @@ This app also bundles [ProFTPD](http://www.proftpd.org/) which provides `sftp://
 
 This app supports running one or more cronjobs. The jobs are specified using the standard crontab syntax.
 
+## ionCube
+
+ionCube is a PHP module extension that loads encrypted PHP files and speeds up webpages. ionCube is pre-installed
+and enabled by default.
+
 ### Remote Terminal
 
 Use the [web terminal](https://cloudron.io/documentation/apps/#web-terminal) for a remote shell connection into the

+ 8 - 0
Dockerfile

@@ -87,6 +87,14 @@ RUN rm -rf /var/spool/cron && ln -s /run/cron /var/spool/cron
 # clear out the crontab
 RUN rm -f /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* && truncate -s0 /etc/crontab
 
+# ioncube. the extension dir comes from php -i | grep extension_dir
+# extension has to appear first, otherwise will error with "The Loader must appear as the first entry in the php.ini file"
+RUN mkdir /tmp/ioncube && \
+    curl http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | tar zxvf - -C /tmp/ioncube && \
+    cp /tmp/ioncube/ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20170718 && \
+    rm -rf /tmp/ioncube && \
+    echo "zend_extension=/usr/lib/php/20170718/ioncube_loader_lin_7.2.so" > /etc/php/7.2/apache2/conf.d/00-ioncube.ini
+
 # configure supervisor
 ADD supervisor/ /etc/supervisor/conf.d/
 RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf

+ 13 - 1
test/test.js

@@ -74,6 +74,15 @@ describe('Application life cycle test', function () {
         });
     }
 
+    function checkIonCube(callback) {
+        browser.get('https://' + app.fqdn).then(function () {
+            return waitForElement(by.xpath('//td[contains(text(), "ionCube Loader")]'));
+            // return waitForElement(by.xpath('//*[contains(text(), "Intrusion Protection&nsbp;from ioncube24.com")]'));
+        }).then(function () {
+            callback();
+        });
+    }
+
     function checkPhpMyAdmin(callback) {
         superagent.get('https://' + app.fqdn + '/phpmyadmin').end(function (error, result) {
             if (error && !error.response) return callback(error); // network error
@@ -136,13 +145,14 @@ describe('Application life cycle test', function () {
     });
 
     it('can view welcome page', welcomePage);
+    it('can access ioncube', checkIonCube);
     it('can upload file with sftp', function () {
         // remove from known hosts in case this test was run on other apps with the same domain already
         // if the tests fail here you want below in ~/.ssh/config
         // Host test.cloudron.xyz
         //     StrictHostKeyChecking no
         //     HashKnownHosts no
-        console.log('If this test fails, see the comment above this log');
+        console.log('If this test fails, see the comment above this log message');
         execSync(util.format('sed -i \'/%s/d\' -i ~/.ssh/known_hosts', app.fqdn));
         execSync(util.format('lftp sftp://%s:%s@%s:%s  -e "set sftp:auto-confirm yes; cd public/; put test.php; bye"', process.env.USERNAME, process.env.PASSWORD, app.fqdn, app.portBindings.SFTP_PORT));
     });
@@ -170,6 +180,7 @@ describe('Application life cycle test', function () {
 
     it('can get uploaded file', uploadedFileExists);
     it('can access phpmyadmin', checkPhpMyAdmin);
+    it('can access ioncube', checkIonCube);
 
     // disable SFTP
     it('can disable sftp', function () {
@@ -226,6 +237,7 @@ describe('Application life cycle test', function () {
     });
     it('can get uploaded file', uploadedFileExists);
     it('can access phpmyadmin', checkPhpMyAdmin);
+    it('can access ioncube', checkIonCube);
 
     it('uninstall app', function () {
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });