intelliants / subrion

Subrion CMS - open source php content management system.
https://subrion.org/
GNU General Public License v3.0
281 stars 118 forks source link

File not found when I try to install plugin #249

Closed wapmorgan closed 7 years ago

wapmorgan commented 7 years ago

Good day. I've installed subrion and very like it. It's really a good cms.

But I faced a problem. When I click on install icon on the plugins page, notification "File not found" pops out.

Version: 4.0.5, installed from official site. Dirs tmp/, plugins/ and tmp/plugins/ are writable. Site is working under https protocol (also after moving to https all font icons don't work). Please, Help me fix this issue.

vbezruchkin commented 7 years ago

Thanks for the feedback, @wapmorgan

  1. Plugin file not found. Please clarify how you install plugins. Have you uploaded the plugin to plugins/ folder? Or you try to install in remote mode.

  2. What template do you use? As some templates have http:// for fonts therefore don't load font when https is enabled on the server.

Thanks

wapmorgan commented 7 years ago
  1. I tried to install in remote mode.
  2. I use default template because also I can't download a new template: I click on install template button, after that nothing happens, page just reloads
vbezruchkin commented 7 years ago

Ok, please submit a ticket with your admin panel + ftp details and we will check what's wrong on your server directly.

Thanks

4unkur commented 7 years ago

There is no such error in our local installations. If you still face this issue, then please submit a ticket in our HelpDesk with FTP details so we could investigate the issue.

Thanks.

wapmorgan commented 7 years ago

Ok, I've made a little investigation and it looks like problem is here, in this code block

if (file_exists($fileName))
            {
                if (is_writable($this->_folder))
                {
                    // delete previous folder
                    if (is_dir($this->_folder . $pluginName))
                    {
                        unlink($this->_folder . $pluginName);
                    }
                    include_once (IA_INCLUDES . 'utils' . IA_DS . 'pclzip.lib.php');
                    $pclZip = new PclZip($fileName);
                    $pclZip->extract(PCLZIP_OPT_PATH, IA_PLUGINS . $pluginName);
                    $this->_iaCore->iaCache->remove('subrion_plugins');
                }
                else
                {
                    $result['message'] = iaLanguage::get('upload_plugin_error');
                }
            }

because later there's a check for files

$installationFile = $this->_folder . $pluginName . IA_DS . iaExtra::INSTALL_FILE_NAME;
        if (!file_exists($installationFile))
        {
            $result['message'] = iaLanguage::get('file_doesnt_exist');
        }

and this error message appears in admin panel. When I manually download and unpack plugins archive Subrion sees it and allows me install it.

Templates are not the same. I can not download any theme from site where subrion does it. For example: https://tools.subrion.org/install/turbosale/1.0.0 But when I download it from https://subrion.org/template/kurut.html and unpack in correct folder, subrion allows activate it.

I'm using PHP 7 and nginx, if it's important.

Again, all dirs with correct access rights.

drwxrwxrwx 7 www-data www-data 4096 Jan 11 00:55 plugins/
drwxrwxrwx 6 www-data www-data 4096 Jan 11 01:28 templates/
drwxrwxrwx 2 www-data www-data 4096 Jan 11 00:28 tmp/plugins/
drwxrwxrwx 2 www-data www-data 4096 Jan 11 01:21 tmp/templates/
wapmorgan commented 7 years ago

Also, I resolved the issue with fonts. That's because of my nginx configuration. I want to share my nginx config to help people using subrion&nginx on your forum, but registration is closed.

wapmorgan commented 7 years ago

Right now I download new theme by this command

T=kurut V=1.0.0 
mkdir $T && cd $T && wget https://subrion.org/get/template/$T/$V.zip && unzip $V && cd .. && chmod -R 777 $T && chown -R www-data $T && chgrp -R www-data $T
vbezruchkin commented 7 years ago

Thanks for your feedback, @wapmorgan

The forums use the same account details you have for Subrion.org website. So you can register here: https://subrion.org/registration/ login at subrion.org and you will be auto-logged in our user forums.

I'm using PHP 7 and nginx, if it's important.

Yes, it's indeed important as 4.0.x is not compatible with PHP7 and it has some errors here and there on the pages (arguments, obsolete constructors, etc.). We make Subrion 4.1.x 100% compatible with PHP7 but it will be released by February.

Thanks

vbezruchkin commented 7 years ago

BTW, here is the nginx based installation on our server.

http://ngx.intelliants.com/

Using this nginx configuration file:

server {
    listen       XXX.XXX.XXX.XXX:80;
    server_name  ngx.intelliants.com;
    root /ABSOLUTE_PATH_TO_SUBRION/;
    server_tokens off;

    index       index.php;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    error_page  404  /404.html;
    location = /404.html {
        root   /opt/nginx/html;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /opt/nginx/html;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/ngx.intelliants.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location /install/ {
        rewrite ^/install/(.*)$ /install/index.php?_p=$1;
    }

    # deny access to apache .htaccess files
    location ~ /\.ht
    {
        deny all;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
}

Hope this helps.

wapmorgan commented 7 years ago

OK, thanks. Also, it's would be good to replace pclzip with something modern like https://github.com/wapmorgan/UnifiedArchive

wapmorgan commented 7 years ago

To approve my words about PclZip oldness there's results of some benchmark.

Filename UA (time) % of PZ PZ (time) UA (mem) % of PZ PZ (mem)
googletools.zip 0.016 69% 0.023 1.18m 99% 1.18m
turbosale_1.0.0.zip 0.219 72% 0.303 1.22m 103% 1.18m
subrion-develop.zip 8.314 50% 16.591 2.03m 171% 1.18m

There's a 30-50% difference in speed and little overhead in memory.

vbezruchkin commented 7 years ago

Thanks for the request, @wapmorgan

Yes, PclZip looks obsolete and it has not been updated for a while. Anyhow, it's just one file without any extra manipulations like composer, etc. It works with zip file format and used for a certain case only, and we can control the source file using for processing.

Yours is a more universal solution with different formats and modern structure. Look good indeed. But I guess we can stick to the current class and focus on the critical functionality. We would be happy to accept merge request, though ;) if you have some time to contribute.

Thanks

P.S. Closing this issue as the subject seems to be resolved.