Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 34... Línea 34...
34
 
34
 
35
    /**
35
    /**
36
     * Rough number of strings that are being processed during a full checkout.
36
     * Rough number of strings that are being processed during a full checkout.
37
     * This is used to estimate the progress of the checkout.
37
     * This is used to estimate the progress of the checkout.
38
     */
38
     */
Línea 39... Línea 39...
39
    const ROUGH_NUMBER_OF_STRINGS = 32000;
39
    const ROUGH_NUMBER_OF_STRINGS = 33000;
40
 
40
 
Línea 41... Línea 41...
41
    /** @var array cache of {@link self::list_components()} results */
41
    /** @var array cache of {@link self::list_components()} results */
Línea 86... Línea 86...
86
     * This should be executed each time before going to the translation page
86
     * This should be executed each time before going to the translation page
87
     *
87
     *
88
     * @param string $lang language code to checkout
88
     * @param string $lang language code to checkout
89
     * @param progress_bar $progressbar optionally, the given progress bar can be updated
89
     * @param progress_bar $progressbar optionally, the given progress bar can be updated
90
     */
90
     */
91
    public static function checkout($lang, progress_bar $progressbar = null) {
91
    public static function checkout($lang, ?progress_bar $progressbar = null) {
92
        global $DB, $CFG;
92
        global $DB, $CFG;
Línea 93... Línea 93...
93
 
93
 
Línea 94... Línea 94...
94
        require_once("{$CFG->libdir}/adminlib.php");
94
        require_once("{$CFG->libdir}/adminlib.php");
Línea 504... Línea 504...
504
            return;
504
            return;
505
        }
505
        }
Línea 506... Línea 506...
506
 
506
 
Línea 507... Línea -...
507
        list($insql, $inparams) = $DB->get_in_or_equal($filter->component, SQL_PARAMS_NAMED);
-
 
508
 
507
        list($insql, $inparams) = $DB->get_in_or_equal($filter->component, SQL_PARAMS_NAMED);
509
        $csql = "SELECT COUNT(*)";
508
 
510
        $fsql = "SELECT s.*, c.name AS component";
509
        $fsql = "SELECT s.*, c.name AS component";
511
        $sql  = "  FROM {tool_customlang_components} c
510
        $sql  = "  FROM {tool_customlang_components} c
512
                   JOIN {tool_customlang} s ON s.componentid = c.id
511
                   JOIN {tool_customlang} s ON s.componentid = c.id
Línea 543... Línea 542...
543
        } else {
542
        } else {
544
            $sql .= "   AND ".$DB->sql_like('s.stringid', ':link', false, true, true); //NOT ILIKE
543
            $sql .= "   AND ".$DB->sql_like('s.stringid', ':link', false, true, true); //NOT ILIKE
545
            $params['link'] = '%\_link';
544
            $params['link'] = '%\_link';
546
        }
545
        }
Línea 547... Línea 546...
547
 
546
 
Línea 548... Línea 547...
548
        $osql = " ORDER BY c.name, s.stringid";
547
        $osql = "component, stringid";
-
 
548
 
-
 
549
        $this->strings = $DB->get_counted_records_sql(
-
 
550
            sql: $fsql.$sql,
-
 
551
            fullcountcolumn: 'fullcount',
549
 
552
            sort: $osql,
-
 
553
            params: $params,
-
 
554
            limitfrom: ($this->currentpage) * self::PERPAGE,
-
 
555
            limitnum: self::PERPAGE,
550
        $this->numofrows = $DB->count_records_sql($csql.$sql, $params);
556
        );
551
        $this->strings = $DB->get_records_sql($fsql.$sql.$osql, $params, ($this->currentpage) * self::PERPAGE, self::PERPAGE);
557
        $this->numofrows = reset($this->strings)->fullcount ?? 0;