1
Lupin
Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/16 15:30

  • Lupin

  • Just popping in

  • Posts: 92

  • Since: 2007/6/1 2


OK, this is really strange ...

Sometimes (without any apparent connection with times or activities ...) we are unable to enter the module administration (version 1.07 final, xoops 2.5.10).
It almost always happens after inserting new categories or items ... but I'm almost sure that it is purely random.
Given the frequency of the problem I activated the debugging and here I report what I read:
1) on the web page: Error : Error: Cannot use object of type stdClass as array
2) in debugging: Errors
Notice: Trying to get property 'tag_name' of non-object in file /modules/publisher/class/Common/VersionChecks.php line 122
Error: Error: Cannot use object of type stdClass as array in file /modules/publisher/class/Common/VersionChecks.php line 123


One question: is it possible to know when the last modification was made to the module?

Thank you

Pino

2
goffy
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/16 19:09

  • goffy

  • Just can't stay away

  • Posts: 504

  • Since: 2010/12/27


Hi Pino

it seems that sometimes connection to github is failing.
Please goto file /modules/publisher/class/Common/VersionChecks.php line 122 and add following if-condition:
$file              json_decode($curlReturnfalse);
                    if (
json_last_error() !== JSON_ERROR_NONE) {
                        
curl_close($curlHandle);
                        return [];
                    }


let me know whether this fix your problem.

goffy

3
Lupin
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/16 19:34

  • Lupin

  • Just popping in

  • Posts: 92

  • Since: 2007/6/1 2


TYVM Goffy ,

tomorrow you will have the report.

Pino

4
Lupin
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/17 15:49

  • Lupin

  • Just popping in

  • Posts: 92

  • Since: 2007/6/1 2




Unfortunately the problem has been repeated ... the two errors (the same) have only moved to lines 127 and 128 ...

Quote:
Notice: Trying to get property 'tag_name' of non-object in file /modules/publisher/class/Common/VersionChecks.php line 127 Error: Error: Cannot use object of type stdClass as array in file /modules/publisher/class/Common/VersionChecks.php line 128


Here the mod.

(#100)
public static function checkVerModule($helper$source 'github'$default 'master')
    {
        
$moduleDirName      basename(dirname(dirname(__DIR__)));
        
$moduleDirNameUpper mb_strtoupper($moduleDirName);
        
$update             '';
        
$repository         'XoopsModules25x/' $moduleDirName;
        
//        $repository         = 'XoopsModules25x/publisher'; //for testing only
        
$ret             '';
        
$infoReleasesUrl "https://api.github.com/repos/$repository/releases";
        if (
'github' === $source) {
            if (
function_exists('curl_init') && false !== ($curlHandle curl_init())) {
                
curl_setopt($curlHandleCURLOPT_URL$infoReleasesUrl);
                
curl_setopt($curlHandleCURLOPT_RETURNTRANSFERtrue);
                
curl_setopt($curlHandleCURLOPT_SSL_VERIFYPEERfalse);
                
curl_setopt($curlHandleCURLOPT_HTTPHEADER, ["User-Agent:Publisherrn"]);
                
$curlReturn curl_exec($curlHandle);
                if (
false === $curlReturn) {
                    
trigger_error(curl_error($curlHandle));
                } elseif (
false !== strpos($curlReturn'Not Found')) {
                    
trigger_error('Repository Not Found: ' $infoReleasesUrl);
                } else {
                    
$file              json_decode($curlReturnfalse);
                      
/* nuovo if */
                    
if (json_last_error() !== JSON_ERROR_NONE) {
                        
curl_close($curlHandle);
                        return [];
                    } 
/* fine nuovo if */
                    
$latestVersionLink sprintf("https://github.com/$repository/archive/%s.zip"$file reset($file)->tag_name $default);
                    
$latestVersion     $file[0]->tag_name;
                    
$prerelease        $file[0]->prerelease;
(
#129)

5
geekwright
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...

I had not realized the new module code was doing this. Cool feature.

I've got a few thoughts.

Looks like we should be checking the CURLINFO_RESPONSE_CODE with curl_getinfo() to make sure the return is a 200. A lot of other codes can be returned with a valid json body that are totally different than the releases body. An example is the 403 response code for a rate limit exceded error - https://developer.github.com/v3/#rate-limiting

We might also consider a more precise end point, like this:
https://api.github.com/repos/XoopsModu ... publisher/releases/latest

To be good github citizens, we should cache the results for some period of time so we don't generate hundreds of checks while doing publisher setup activities. The period could easily be an hour or more. Xmf\Module\Helper\Cache::cacheRead() could make that easy.

One last observation not directly related to this issue, since publisher can be cloned, it looks like this check will not get any data, or wrong data from another module.

6
Lupin
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/23 16:50

  • Lupin

  • Just popping in

  • Posts: 92

  • Since: 2007/6/1 2


Is anyone working on this problem?
Since yesterday none of the administrators has managed to enter the administration panel of the module !!!
Since we would soon need to go into production, is it possible to have a version without this "automatic data collector"?

Thanks

Pino

7
Mamba
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/23 23:25

  • Mamba

  • Moderator

  • Posts: 11258

  • Since: 2004/4/23


Just comment out lines 92-95 in /admin/index.php:

//$newRelease = $utility::checkVerModule($helper);
//if (!empty($newRelease)) {
    //$adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"');
//}
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

8
Lupin
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/24 19:44

  • Lupin

  • Just popping in

  • Posts: 92

  • Since: 2007/6/1 2


TYVM Mamba ,

I will report.

Pino

9
Lupin
Re: Cannot enter in PUBLISHER module administration ... but "sometimes" ...
  • 2020/1/30 19:41

  • Lupin

  • Just popping in

  • Posts: 92

  • Since: 2007/6/1 2


Of course , no more service interruptions !

TY

Pino

Login

Who's Online

66 user(s) are online (42 user(s) are browsing Support Forums)


Members: 0


Guests: 66


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits