To update language files in case of the role name is changed.
@param $oldRoleName
@param $newRoleName
424070
private function updateLanguageTerm($oldRoleName, $newRoleName)
    {
        $folder = resource_path("lang/*/role.php");
        foreach (glob($folder) as $langFile) {
            $langFileContent = require $langFile;
            if (!isset($langFileContent['roles'])) {
                $langFileContent['roles'] = [];
            }
            if (isset($langFileContent['roles'][$oldRoleName])) {
                $langFileContent['roles'][$newRoleName] = $langFileContent['roles'][$oldRoleName];
                unset($langFileContent['roles'][$oldRoleName]);
                $langContent = "<?php\n\nreturn " . Utils::exportArray($langFileContent) . ";\n";
                file_put_contents($langFile, $langContent);
            }
        }
    }
628778
@Post("/metadata/{projectName}/repos/{repoName}/perm/role")
    public CompletableFuture<Revision> updateRolePermission(@Param("projectName") String projectName,
                                                            @Param("repoName") String repoName,
                                                            PerRolePermissions newPermission,
                                                            Author author) {
        return mds.updatePerRolePermissions(author, projectName, repoName, newPermission);
    }
328564
private function renameTable($old, $new) {
        $renameSql = 'alter table '.
            $this->prefixTable($old).
            ' rename to '.
            $this->prefixTable($new);
        $this->queryDefine($renameSql);
    }
534967
public function updated(Permission $permission)
    {
        $original = $permission->getOriginal();
        if (count($original)) {
            $oldPermission = new Permission($original);
            if ($permission->name != $oldPermission->name) {
                $this->updateLanguageTerm($oldPermission, $permission);
            }
        } elseif ($permission->is_default_action === false) {
            $this->createLanguageTerm($permission->model, $permission->action);
        }
    }
898157
public function rename(String $oldName, String $newName) : Bool
    {
        if( @ssh2_sftp_rename($this->connect, $oldName, $newName) )
        {
            return true;
        }
        else
        {
            throw new FolderChangeNameException(NULL, $oldName);
        }
    }
425962
public function rename($dn, $newrdn, $newparent = null, $deleteoldrdn = true)
    {
        $this->_debug("C: Rename $dn to $newrdn");

        if (!ldap_rename($this->conn, $dn, $newrdn, $newparent, $deleteoldrdn)) {
            $this->_error("ldap_rename() failed with " . ldap_error($this->conn));
            return false;
        }

        $this->_debug("S: OK");
        return true;
    }
204702
public function renameSection($old, $new, $log = false)
    {
        Daemon::$config->{$new} = Daemon::$config->{$old};
        unset(Daemon::$config->{$old});
        if ($log) {
            Daemon::log('Config section \'' . $old . '\' -> \'' . $new . '\'');
        }
    }
657310
public function rename($old_name, $new_name)
    {
        $old_name = $this->_getAbsoluteRemotePath($old_name);
        $new_name = $this->_getAbsoluteRemotePath($new_name);

        if (false === file_exists($old_name)) {
            return $this->_trigger_error(sprintf('Could not open remote file: %s.', $old_name));
        }

        if (true === file_exists($new_name)) {
            return $this->_trigger_error(sprintf('Remote file already exists: %s.', $new_name));
        }

        if (false === @rename($old_name, $new_name)) {
            return $this->_trigger_error(sprintf('Unable to rename %s to %s', $old_name, $new_name));
        }

        return true;
    }
1365687
public function renameFile($name, $newName)
    {
        foreach ($this->getAllFields() as $field) {
            $path = $this->getFilePath($field, $name);
            $newPath = $this->getFilePath($field, $newName);
            if (file_exists($newPath)) {
                throw new \Exception("File {$newName} already exists");
            }
            rename($path, $newPath);
        }
        if ($name == $this->owner->getAttribute($this->fileField)
            && ($files = $this->getFileList())
        ) {
            $this->owner->updateAttributes([$this->fileField => $newName]);
        }
        return true;
    }
380966
public function update(Role $role, UpdateRole $request)
    {
        try {
            $role->update($request->except('permissions'));
            $role->syncPermissions($request->permissions());

            flash()->success(__('The :name role has been updated', ['name' => $role->name]));
        } catch (\Exception $e) {
            flash()->error(__('Error: :msg', ['msg' => $e->getMessage()]));
            return redirect()->back();
        }

        return redirect(route('appshell.role.show', $role));
    }
836691
public function updatePath($oldPath, $newPath)
    {
        if ($this->contains($oldPath)) {
            $this->items[$newPath] = $this->items[$oldPath];
            unset($this->items[$oldPath]);
        }
    }
1121751
private function updateUserRole(UserRole $userRole, $userRoleData)
    {
        $role = $this->roleRepository->findRoleById($userRoleData['role']['id']);

        if (!$role) {
            throw new EntityNotFoundException($this->roleRepository->getClassName(), $userRole['role']['id']);
        }

        $userRole->setRole($role);
        if (array_key_exists('locales', $userRoleData)) {
            $userRole->setLocale(json_encode($userRoleData['locales']));
        } else {
            $userRole->setLocale($userRoleData['locale']);
        }

        return true;
    }
391547
public function renameFile($fileIndex, $newFileName)
    {
        foreach ($this->lines as $line) {
            $line->renameFile($fileIndex, $newFileName);
        }
    }
326208
public function rename($oldName, $newName)
    {
        if (! ssh2_sftp_rename($this->sFtp, $oldName, $newName)) {
            throw new \RuntimeException('Name can not be changed');
        }
        return true;
    }
1013271
public function updated(Role $role)
    {
        $oldRole = new Role($role->getOriginal());
        $oldRoleName = $oldRole->snake_case_name;
        $newRoleName = $role->snake_case_name;
        if ($newRoleName != $oldRoleName) {
            $this->updateLanguageTerm($oldRoleName, $newRoleName);
        }
    }
1295080
public function createNewLanguage(string $newLocale)
    {
        if (count($this->getAvailableLanguages()) >= $this->allowedLanguages) {
            throw new DirectoryNotCreatedException("Max number of allowed languages alread reached.");
        }

        if (!$this->fileSystem->makeDirectory($this->getLanguagesPath() . DIRECTORY_SEPARATOR . $newLocale)) {
            throw new DirectoryNotCreatedException("New directory for locale $newLocale cannot be created.");
        }

        return true;
    }
86646
public static function rename(string $name, string $newName, bool $overwrite = true): void
	{
		NetteFileSystem::rename($name, $newName, $overwrite);
	}