GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 70-72 lines in 2 locations

symphony/content/content.blueprintsdatasources.php 1 location

@@ 1397-1468 (lines=72) @@
1394
            $dsShell = preg_replace(array('/<!--[\w ]++-->/', '/(\t+[\r\n]){2,}/', '/(\r\n){2,}/'), '$1', $dsShell);
1395
1396
            // Write the file
1397
            if (!is_writable(dirname($file)) || !General::writeFile($file, $dsShell, Symphony::Configuration()->get('write_mode', 'file'), 'w', true)) {
1398
                $this->pageAlert(
1399
                    __('Failed to write Data source to disk.')
1400
                    . ' ' . __('Please check permissions on %s.', array('<code>/workspace/data-sources</code>')),
1401
                    Alert::ERROR
1402
                );
1403
1404
                // Write successful
1405
            } else {
1406
                if (function_exists('opcache_invalidate')) {
1407
                    opcache_invalidate($file, true);
1408
                }
1409
1410
                // Attach this datasources to pages
1411
                $connections = $fields['connections'];
1412
                ResourceManager::setPages(ResourceManager::RESOURCE_TYPE_DS, is_null($existing_handle) ? $classname : $existing_handle, $connections);
1413
1414
                // If the datasource has been updated and the name changed, then adjust all the existing pages that have the old datasource name
1415
                if ($queueForDeletion) {
1416
                    General::deleteFile($queueForDeletion);
1417
1418
                    // Update pages that use this DS
1419
                    $pages = PageManager::fetch(false, array('data_sources', 'id'), array("
1420
                        `data_sources` REGEXP '[[:<:]]" . $existing_handle . "[[:>:]]'
1421
                    "));
1422
1423
                    if (is_array($pages) && !empty($pages)) {
1424
                        foreach ($pages as $page) {
1425
                            $page['data_sources'] = preg_replace('/\b'.$existing_handle.'\b/i', $classname, $page['data_sources']);
1426
1427
                            PageManager::edit($page['id'], $page);
1428
                        }
1429
                    }
1430
                }
1431
1432
                if ($this->_context['action'] === 'new') {
1433
                    /**
1434
                     * After creating the Datasource, the path to the Datasource file is provided
1435
                     *
1436
                     * @delegate DatasourcePostCreate
1437
                     * @since Symphony 2.2
1438
                     * @param string $context
1439
                     * '/blueprints/datasources/'
1440
                     * @param string $file
1441
                     *  The path to the Datasource file
1442
                     */
1443
                    Symphony::ExtensionManager()->notifyMembers('DatasourcePostCreate', '/blueprints/datasources/', array(
1444
                        'file' => $file
1445
                    ));
1446
                } else {
1447
                    /**
1448
                     * After editing the Datasource, the path to the Datasource file is provided
1449
                     *
1450
                     * @delegate DatasourcePostEdit
1451
                     * @since Symphony 2.2
1452
                     * @param string $context
1453
                     * '/blueprints/datasources/'
1454
                     * @param string $file
1455
                     *  The path to the Datasource file
1456
                     * @param string $previous_file
1457
                     *  The path of the previous Datasource file in the case where a Datasource may
1458
                     *  have been renamed. To get the handle from this value, see
1459
                     *  `DatasourceManager::__getHandleFromFilename`
1460
                     */
1461
                    Symphony::ExtensionManager()->notifyMembers('DatasourcePostEdit', '/blueprints/datasources/', array(
1462
                        'file' => $file,
1463
                        'previous_file' => ($queueForDeletion) ? $queueForDeletion : null
1464
                    ));
1465
                }
1466
1467
                redirect(SYMPHONY_URL . '/blueprints/datasources/edit/'.$classname.'/'.($this->_context['action'] === 'new' ? 'created' : 'saved') . '/');
1468
            }
1469
        }
1470
    }
1471

symphony/content/content.blueprintsevents.php 1 location

@@ 583-652 (lines=70) @@
580
            }
581
582
            // Write the file
583
            if (!is_writable(dirname($file)) || !General::writeFile($file, $eventShell, Symphony::Configuration()->get('write_mode', 'file'))) {
584
                $this->pageAlert(
585
                    __('Failed to write Event to disk.')
586
                    . ' ' . __('Please check permissions on %s.', array('<code>/workspace/events</code>')),
587
                    Alert::ERROR
588
                );
589
590
                // Write successful
591
            } else {
592
                if (function_exists('opcache_invalidate')) {
593
                    opcache_invalidate($file, true);
594
                }
595
596
                // Attach this event to pages
597
                $connections = $fields['connections'];
598
                ResourceManager::setPages(ResourceManager::RESOURCE_TYPE_EVENT, is_null($existing_handle) ? $classname : $existing_handle, $connections);
599
600
                if ($queueForDeletion) {
601
                    General::deleteFile($queueForDeletion);
602
603
                    $pages = PageManager::fetch(false, array('events', 'id'), array("
604
                        `events` REGEXP '[[:<:]]" . $existing_handle . "[[:>:]]'
605
                    "));
606
607
                    if (is_array($pages) && !empty($pages)) {
608
                        foreach ($pages as $page) {
609
                            $page['events'] = preg_replace('/\b'.$existing_handle.'\b/i', $classname, $page['events']);
610
611
                            PageManager::edit($page['id'], $page);
612
                        }
613
                    }
614
                }
615
616
                if ($this->_context['action'] === 'new') {
617
                    /**
618
                     * After creating the Event, the path to the Event file is provided
619
                     *
620
                     * @delegate EventPostCreate
621
                     * @since Symphony 2.2
622
                     * @param string $context
623
                     * '/blueprints/events/'
624
                     * @param string $file
625
                     *  The path to the Event file
626
                     */
627
                    Symphony::ExtensionManager()->notifyMembers('EventPostCreate', '/blueprints/events/', array(
628
                        'file' => $file
629
                    ));
630
                } else {
631
                    /**
632
                     * After editing the Event, the path to the Event file is provided
633
                     *
634
                     * @delegate EventPostEdit
635
                     * @since Symphony 2.2
636
                     * @param string $context
637
                     * '/blueprints/events/'
638
                     * @param string $file
639
                     *  The path to the Event file
640
                     * @param string $previous_file
641
                     *  The path of the previous Event file in the case where an Event may
642
                     *  have been renamed. To get the handle from this value, see
643
                     *  `EventManager::__getHandleFromFilename`
644
                     */
645
                    Symphony::ExtensionManager()->notifyMembers('EventPostEdit', '/blueprints/events/', array(
646
                        'file' => $file,
647
                        'previous_file' => ($queueForDeletion) ? $queueForDeletion : null
648
                    ));
649
                }
650
651
                redirect(SYMPHONY_URL . '/blueprints/events/edit/'. $classname . '/' . ($this->_context['action'] === 'new' ? 'created' : 'saved') . '/');
652
            }
653
        }
654
    }
655