Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in PageIndex.php handling of custom columns in multi db COPS instances #89

Closed
Chirishman opened this issue Jun 8, 2024 · 2 comments
Labels
backend About COPS backend (PHP code)

Comments

@Chirishman
Copy link

Since these changes I am seeing this error in the logs

  thrown in /app/www/public/lib/Pages/PageIndex.php on line 199" while reading response header from upstream, client: 10.1.2.42, server: _, request: "GET /feed.php?db=0 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "library.chiriserv.com"
2024/06/08 15:21:14 [error] 257#257: *245 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function setHandler() on null in /app/www/public/lib/Pages/PageIndex.php:199
Stack trace:
#0 /app/www/public/lib/Pages/PageIndex.php(52): SebLucas\Cops\Pages\PageIndex->getTopCountEntries()
#1 /app/www/public/lib/Pages/PageIndex.php(35): SebLucas\Cops\Pages\PageIndex->getEntries()
#2 /app/www/public/lib/Handlers/FeedHandler.php(61): SebLucas\Cops\Pages\PageIndex->InitializeContent()
#3 /app/www/public/lib/Framework.php(56): SebLucas\Cops\Handlers\FeedHandler->handle()
#4 /app/www/public/feed.php(15): SebLucas\Cops\Framework::run()
#5 {main}
  thrown in /app/www/public/lib/Pages/PageIndex.php on line 199" while reading response header from upstream, client: 10.1.2.42, server: _, request: "GET /feed.php?db=0 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "library.chiriserv.com"

Which is a call to this:

$customColumn->setHandler($this->handler);

Based on the variable on that line I would guess this has to do with the fact that I have different custom columns in some of my libraries than others. Previously this was being handled without any terminating errors.

this is my config_local.php

<?php
    if (!isset($config))
        $config = array();

    /*
     * The directory containing calibre's metadata.db file, with sub-directories
     * containing all the formats.
     * BEWARE : it has to end with a /
	 * $config['calibre_directory'] = '/books/ebooks/';
     */
    $config['calibre_directory'] = array ("eBooks" => "/books/ebooks/", "Comics" => "/books/comics/", "Manga" => "/books/manga/", "Fanfiction" => "/books/fanfiction/", "Webfiction" => "/books/webfiction/", "Light Novels" => "/books/lightnovels/");

    if (!empty ($_GET) && isset($_GET['db']) && $_GET['db'] != '') {
        if ( $_GET['db'] == 0 )
            $config['calibre_internal_directory'] = "/books/ebooks/";
        elseif ( $_GET['db'] == 1 )
               $config['calibre_internal_directory'] = "/books/comics/";
        elseif ( $_GET['db'] == 2 )
               $config['calibre_internal_directory'] = "/books/manga/";
        elseif ( $_GET['db'] == 3 )
               $config['calibre_internal_directory'] = "/books/fanfiction/";
        elseif ( $_GET['db'] == 4 )
               $config['calibre_internal_directory'] = "/books/webfiction/";
        elseif ( $_GET['db'] == 5 )
               $config['calibre_internal_directory'] = "/books/lightnovels/";
    }

    /*
     * Catalog's title
     */
    $config['cops_title_default'] = "COPS";

    /*
     * use URL rewriting for downloading of ebook in HTML catalog
     * See README for more information
     *  1 : enable
     *  0 : disable
     */
    $config['cops_use_url_rewriting'] = "0";
    $config['cops_ignored_categories'] = array("language");
    $config['cops_ignored_formats'] = ['ORIGINAL_EPUB', 'ORIGINAL_AZW3'];
    $config['cops_opds_filter_links'] = [];
    $config['cops_opds_sort_links'] = [];
    $config['cops_prefered_format'] = ['EPUB', 'M4B', 'AZW3', 'AZW', 'MOBI', 'CBR', 'CBZ', 'PDF'];
    $config['cops_calibre_custom_column'] = array("new","characters","fictype","pairings","pairingtypes","parody","relationships","status");
    $config['cops_calibre_custom_column_list'] = array ("new","characters","fictype","updated","lastchecked","chapters","wordcount","pairings","pairingtypes","parody","relationships","status","warnings","contentrated");
    $config['cops_calibre_custom_column_preview'] = array ("new","characters","fictype","updated","lastchecked","chapters","wordcount","pairings","pairingtypes","parody","relationships","status","warnings","contentrated");

     $config['cops_x_accel_redirect'] = "";
    /* Enable cache folder
     * especially useful for lower power hosts
     */
    $config['cops_thumbnail_handling'] = "";
    $config['cops_thumbnail_cache_directory'] = "/config/cache/";

Certain columns like "wordcount" don't exist in the comic and manga libraries, and "parody" exists only in the fanfiction one. As I said, this hasn't caused any terminating errors until now.

@mikespub mikespub added the backend About COPS backend (PHP code) label Jul 15, 2024
@mikespub
Copy link
Member

Thanks @Chirishman for tracking this down and explaining the context.
And this is a good use case for any other "invalid" custom column issues

@mikespub
Copy link
Member

Included in release 2.7.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend About COPS backend (PHP code)
Projects
None yet
Development

No branches or pull requests

2 participants