Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Filecount issue in torrents-upload?
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2021-10-23 21:26:44
I looked at someone who forked the v3 code and they fixed an apparent filecount issue that I didnt even know existed. I looked at my database and noticed that the filecount in the torrents is indeed ZERO. I dont exactly know what the filecount even really does that makes any real difference, but nonetheless, here is the fix in torrents-upload, find and add
	$announce = $TorrentInfo[0];
$infohash = $TorrentInfo[1];
$creationdate = $TorrentInfo[2];
$internalname = $TorrentInfo[3];
$torrentsize = $TorrentInfo[4];
$filecount = $TorrentInfo[5];
//filecount fix
if (false === \is_countable($filecount)) {
   $filecount = 1;
}
//end filecount fix
$annlist = $TorrentInfo[6];
$comment = $TorrentInfo[7];
$filelist = $TorrentInfo[8];

all credit goes to this person https://github.com/LokiThor2021
Post if this makes a difference for you, or just let everyone know what your findings are


SEE MY POST BELOW FOR A CORRECT FIX. DO NOT USE THIS. I WAS WORKING THROUGH A PROBLEM AND WANTED THE CORRECT FIX
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-10-29 23:09:06
2021-10-24 11:42:53
Big thanks LokiThor2021 / MicroMonkey  :thumb
2021-10-26 05:40:19
SPL class DirectoryIterator doesn’t work here, so it’s counting [info][files] occurrences recursively.

There’s a mountain of answers for this on SO.
2021-10-27 22:07:44
I looked at this briefly this morning, and I think this count is handled in the parse.php file, not here, so I dont think this fix is correct. Thats why I asked if anyone else could expand on it. Gotta check the filecount in parse
I think is the issue, the is_numeric
					foreach ($infovariable["files"] as $file) {
if(is_numeric($filecount))
$filecount += "1";
$multiname = $file['path'];//Not needed here really
$multitorrentsize = $file['length'];
$torrentsize += $file['length'];
}


There was a reason I added that, but I could have been wrong. Perhaps it should be is_countable and NOT is_numeric. Can anyone check that out?
					foreach ($infovariable["files"] as $file) {
if(is_countable($filecount))
$filecount += "1";
$multiname = $file['path'];//Not needed here really
$multitorrentsize = $file['length'];
$torrentsize += $file['length'];
}


TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-10-27 23:50:43
2021-10-28 01:36:12
You can use a number of ways to count the array occurrences.

You can define a counter by
$c = 0
(Foreach/While)
$count = $c++;
(EndForeach/EndWhile)

$filecount = ($count > 0) ? intval($count) : 0;


—

Or simply read a column alias, like COUNT(*) and call upon its value in the loop. I don’t find count() ever reliable so I think I misunderstand that function.
Last edited by STorrents2020 on 2021-10-28 01:46:48
2021-10-28 01:40:46
I’ll figure it out. Just trying to get my login working on Chrome, seems all my info was on Safari  :confound

EDIT: Im logged in now (not limited to my phone)

can someone provide me a sample array of the output of :

print_r($infovariable["files"]);


Otherwise I assume this:

$infovariable["files"] = array(0 => 'file1.jpg', 1 => 'file2.jpg');
Last edited by STorrents2020 on 2021-10-28 01:46:36
2021-10-28 21:13:36
did it with a test upload. This file has 6 files associated with it. Output here
Array ( [0] => Array ( [length] => 473284177 [path] => Array ( [0] => american.horror.stories.s01e01.720p.web.h264-cakes.mkv ) ) [1] => Array ( [length] => 262 [path] => Array ( [0] => american.horror.stories.s01e01.720p.web.h264-cakes.nfo ) ) [2] => Array ( [length] => 683830 [path] => Array ( [0] => Screens [1] => screen0001.png ) ) [3] => Array ( [length] => 1255374 [path] => Array ( [0] => Screens [1] => screen0002.png ) ) [4] => Array ( [length] => 515620 [path] => Array ( [0] => Screens [1] => screen0003.png ) ) [5] => Array ( [length] => 731102 [path] => Array ( [0] => Screens [1] => screen0004.png ) ) ) 

I think the problem is here tho on line 87. I guess $filecount isnt behaving, it does output file numbers, like 12345
$filecount += "1";
you get Warning: A non-numeric value encountered in /var/www/test/backend/parse.php on line 87
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-10-28 21:42:34
2021-10-29 16:41:48
this is what i have and it seems to work on my version

	$announce = $TorrentInfo[0];
$infohash = $TorrentInfo[1];
$creationdate = $TorrentInfo[2];
$internalname = $TorrentInfo[3];
$torrentsize = $TorrentInfo[4];
$filecount = $TorrentInfo[5];
$annlist = $TorrentInfo[6];
$comment = $TorrentInfo[7];
$filelist = $TorrentInfo[8];


then further down find
            if ($anonyupload == "yes") {
               $anon = "yes";
           } else {
               $anon = "no";
           }


below add filecounts as int
            $filecounts = (int) $filecount;


now in the insert query just below find $filecount var and change to
$filecounts


so like this for v3 but do not use this because your code will be modded

$ret = SQL_Query_exec("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action) VALUES (".sqlesc($fname).", '".$CURUSER['id']."', ".sqlesc($name).", ".sqlesc($descr).", '".$inames[0]."', '".$inames[1]."', '".$catid."', '" . get_date_time() . "', '".$infohash."', '".$torrentsize."', '".$filecounts."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$nfo."', '".$langid."','$anon', '".get_date_time()."')");
2021-10-29 20:40:56
The problem is/was that you get a warning thrown in parse.php. The way you did it m-jay does work, but it didnt address the warning in parse for TTv3 for non-numeric, but you made me remember the INT lol. Thanks for that. I think I fixed it. In parse.php find and put
$filecount = (int) $filecount;


so like this
                        foreach ($infovariable["files"] as $file) {
                           $filecount = (int) $filecount;
                           $filecount += 1;
                           $multiname = $file['path']; //Not needed here really
                           $multitorrentsize = $file['length'];
                           $torrentsize += $file['length'];
                       }

So in the TTv3 code, you will NOT have the (is_numeric) part anymore. That was something I did without checking the output just to suppress that warning. That was back when I converted this to php 7 I think, and WOW was I wrong lol. Just use the function above in parse.php Undo all edits I posted in the first post of this thread and use this instead. Sorry about that folks. I will update github accordingly
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-10-29 23:18:50
2021-10-29 22:58:42
:thumb thanks
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728