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.

Issues (113)

recipe/drupal7.php (1 issue)

Labels
Severity
1
<?php
2
namespace Deployer;
3
4
require_once __DIR__ . '/common.php';
5
6
task('deploy', [
7
    'deploy:info',
8
    'deploy:setup',
9
    'deploy:lock',
10
    'deploy:release',
11
    'deploy:update_code',
12
    'deploy:shared',
13
    'deploy:writable',
14
    'deploy:symlink',
15
    'deploy:unlock',
16
    'deploy:cleanup'
17
]);
18
19
//Set Drupal 7 site. Change if you use different site
20
set('drupal_site', 'default');
21
22
//Drupal 7 shared dirs
23
set('shared_dirs', [
24
    'sites/{{drupal_site}}/files',
25
]);
26
27
//Drupal 7 shared files
28
set('shared_files', [
29
    'sites/{{drupal_site}}/settings.php',
30
]);
31
32
//Drupal 7 writable dirs
33
set('writable_dirs', [
34
    'sites/{{drupal_site}}/files',
35
]);
36
37
38
//Create and upload Drupal 7 settings.php using values from secrets
39
task('drupal:settings', function () {
40
    if (askConfirmation('Are you sure to generate and upload settings.php file?')) {
41
42
        //Get template
43
        $template = get('settings_template');
44
45
        //Import secrets
46
        $secrets = get('settings');
47
48
        //Prepare replacement variables
49
        $iterator = new \RecursiveIteratorIterator(
50
            new \RecursiveArrayIterator($secrets)
0 ignored issues
show
It seems like $secrets can also be of type string; however, parameter $array of RecursiveArrayIterator::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

50
            new \RecursiveArrayIterator(/** @scrutinizer ignore-type */ $secrets)
Loading history...
51
        );
52
53
        $replacements = [];
54
        foreach ($iterator as $key => $value) {
55
            $keys = [];
56
            for ($i = $iterator->getDepth(); $i > 0; $i --) {
57
                $keys[] = $iterator->getSubIterator($i - 1)->key();
58
            }
59
            $keys[] = $key;
60
61
            $replacements['{{' . implode('.', $keys) . '}}'] = $value;
62
        }
63
64
        //Create settings from template
65
        $settings = file_get_contents($template);
66
67
        $settings = strtr($settings, $replacements);
68
69
        writeln('settings.php created successfully');
70
71
        $tmpFilename = tempnam(sys_get_temp_dir(), 'tmp_settings_');
72
        file_put_contents($tmpFilename, $settings);
73
74
        upload($tmpFilename, '{{deploy_path}}/shared/sites/{{drupal_site}}/settings.php');
75
76
        unlink($tmpFilename);
77
    }
78
});
79
80
//Upload Drupal 7 files folder
81
task('drupal:upload_files', function () {
82
    if (askConfirmation('Are you sure?')) {
83
        upload('sites/{{drupal_site}}/files', '{{deploy_path}}/shared/sites/{{drupal_site}}/files');
84
    }
85
});
86