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

更新到最新的支持Laravel 8.5 #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
/vendor
composer.lock
/node_modules
/public/storage
Homestead.yaml
Homestead.json
docker/data
.env
.user.ini
/index.html
/404.html
/.htaccess
storage/test
old_vendor
new_vendor
app/test/*
config/*_local.php
storage/app
storage/_old_app
storage/app/.gitignore
storage/app/public/.gitignore
composer.lock
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified app/Acl/Acl.php
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions app/Acl/Eloquent/Group.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Group extends Model
protected $fillable = array(
'name',
'users',
'principal',
'public_scope',
'description',
'directory',
'ldap_dn',
Expand Down
Empty file modified app/Acl/Eloquent/Role.php
100644 → 100755
Empty file.
Empty file modified app/Acl/Eloquent/RolePermissions.php
100644 → 100755
Empty file.
Empty file modified app/Acl/Eloquent/Roleactor.php
100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion app/Acl/Permissions.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Permissions {
const EDIT_ISSUE = 'edit_issue';
const EDIT_SELF_ISSUE = 'edit_self_issue';
const DELETE_ISSUE = 'delete_issue';
const DELETE_SELF_ISSUE = 'delete_self_issue';
const LINK_ISSUE = 'link_issue';
const MOVE_ISSUE = 'move_issue';
const RESOLVE_ISSUE = 'resolve_issue';
Expand Down Expand Up @@ -58,6 +59,7 @@ public static function all()
static::EDIT_ISSUE,
static::EDIT_SELF_ISSUE,
static::DELETE_ISSUE,
static::DELETE_SELF_ISSUE,
static::LINK_ISSUE,
static::MOVE_ISSUE,
static::RESOLVE_ISSUE,
Expand Down Expand Up @@ -86,4 +88,4 @@ public static function all()
];
}

}
}
Empty file modified app/ActiveDirectory/Eloquent/Directory.php
100644 → 100755
Empty file.
Empty file modified app/ActiveDirectory/LDAP.php
100644 → 100755
Empty file.
Empty file modified app/Console/Commands/Inspire.php
100644 → 100755
Empty file.
10 changes: 9 additions & 1 deletion app/Console/Commands/RemoveLogs.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct()
public function handle()
{
$durations = [
'0d' => 'now',
'3m' => '3 months',
'6m' => '6 months',
'1y' => '1 year',
Expand All @@ -56,7 +57,14 @@ public function handle()
}
}

$removed_at = strtotime('-' . $log_save_duration);
if ($log_save_duration == 'now')
{
$removed_at = strtotime($log_save_duration) * 1000;
}
else
{
$removed_at = strtotime('-' . $log_save_duration) * 1000;
}

ApiAccessLogs::where('requested_start_at', '<', $removed_at)->delete();
}
Expand Down
12 changes: 11 additions & 1 deletion app/Console/Commands/SendEmails.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,15 @@ public function otherNoticeHandle($project, $activity)

$uids = Acl::getUserIdsByPermission('view_project', $project->key);

$to_users = EloquentUser::find(array_unique($uids));
$to_users = EloquentUser::find(array_values(array_unique($uids)));

foreach ($to_users as $to_user)
{
if ($to_user->invalid_flag == 1)
{
continue;
}

$from = $activity['user']['name'];
$to = $to_user['email'];
try {
Expand Down Expand Up @@ -520,6 +525,11 @@ public function issueNoticeHandle($project, $activity)
$to_users = EloquentUser::find(array_values(array_unique(array_filter($uids))));
foreach ($to_users as $to_user)
{
if ($to_user->invalid_flag == 1)
{
continue;
}

$new_data = $data;
if (in_array($to_user->id, $atWho))
{
Expand Down
Empty file modified app/Console/Commands/SnapSprint.php
100644 → 100755
Empty file.
Empty file modified app/Console/Commands/SyncLdap.php
100644 → 100755
Empty file.
Empty file modified app/Console/Commands/TriggerWebhooks.php
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion app/Console/Kernel.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
'App\Console\Commands\SyncLdap',
'App\Console\Commands\SnapSprint',
'App\Console\Commands\RemoveLogs',
'App\Console\Commands\ImportFile',
// Commands\Inspire::class,
];

Expand All @@ -31,7 +32,7 @@ protected function schedule(Schedule $schedule)
$schedule->command('email:send')
->everyMinute();
$schedule->command('sprint:snap')
->hourly();
->dailyAt('23:20');
$schedule->command('ldap:sync')
->daily();
$schedule->command('logs:remove')
Expand Down
Empty file modified app/Customization/Eloquent/EventNotifications.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/Events.php
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions app/Customization/Eloquent/Field.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class Field extends Model
'description',
'defaultValue',
'optionValues',
'minValue',
'maxValue',
'maxLength',
'project_key'
);
}
Empty file modified app/Customization/Eloquent/Priority.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/PriorityProperty.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/Resolution.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/ResolutionProperty.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/Screen.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/State.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/StateProperty.php
100644 → 100755
Empty file.
Empty file modified app/Customization/Eloquent/Type.php
100644 → 100755
Empty file.
Empty file modified app/Events/AddGroupToRoleEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/AddUserToRoleEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/DelGroupEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/DelGroupFromRoleEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/DelUserEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/DelUserFromRoleEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/DocumentEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/Event.php
100644 → 100755
Empty file.
Empty file modified app/Events/FieldChangeEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/FieldDeleteEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/FileDelEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/FileUploadEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/IssueEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/ModuleEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/PriorityConfigChangeEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/ResolutionConfigChangeEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/SprintEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/VersionEvent.php
100644 → 100755
Empty file.
Empty file modified app/Events/WikiEvent.php
100644 → 100755
Empty file.
43 changes: 16 additions & 27 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,40 @@

namespace App\Exceptions;

use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
//
];

/**
* Report or log an exception.
* A list of the inputs that are never flashed for validation exceptions.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
* @var array
*/
public function report(Exception $e)
{
parent::report($e);
}
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Render an exception into an HTTP response.
* Register the exception handling callbacks for the application.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
* @return void
*/
public function render($request, Exception $e)
public function register()
{
$ecode = $e->getCode() ?: -99999;
return [ 'ecode' => $ecode, 'emsg' => $e->getMessage() ];
//return parent::render($request, $e);
$this->reportable(function (Throwable $e) {
//
});
}
}
Empty file modified app/Http/Controllers/AccessLogsController.php
100644 → 100755
Empty file.
14 changes: 13 additions & 1 deletion app/Http/Controllers/ActivityController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function index(Request $request, $project_key)

$query->whereRaw([ 'issue_id' => [ '$exists' => 1 ] ]);

$query->orderBy('_id', 'desc');
$query->orderBy('created_at', 'desc');

$limit = $request->input('limit');
if (!isset($limit))
Expand All @@ -49,8 +49,13 @@ public function index(Request $request, $project_key)

$avatars = [];
$activities = $query->get();
// $activities = $query->get();
$activities = $this->arr_fix($activities);
foreach ($activities as $key => $activity)
{
// $r = $activity;
// dump($r);
$activity = $this->arr_fix($activity);
if (!array_key_exists($activity['user']['id'], $avatars))
{
$user = Sentinel::findById($activity['user']['id']);
Expand Down Expand Up @@ -86,6 +91,8 @@ public function index(Request $request, $project_key)
{
$issue = DB::collection('issue_' . $project_key)->where('_id', $activity['data']['dest'])->first();
}
if(!$issue) continue;
$issue = $this->arr_fix($issue);
$activities[$key]['issue_link']['dest'] = [
'id' => $activity['data']['dest'],
'no' => $issue['no'],
Expand All @@ -103,6 +110,11 @@ public function index(Request $request, $project_key)
{
$issue = DB::collection('issue_' . $project_key)->where('_id', $activity['issue_id'])->first();
}
// dump($activity['issue_id']);
// dump($issue);
// exit;
if(!$issue) continue;
$issue = $this->arr_fix($issue);
$activities[$key]['issue'] = [
'id' => $activity['issue_id'],
'no' => $issue['no'],
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/AuthController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Controllers\Auth;

use App\User;
use App\Models\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
Expand Down
Empty file modified app/Http/Controllers/Auth/PasswordController.php
100644 → 100755
Empty file.
8 changes: 8 additions & 0 deletions app/Http/Controllers/BoardController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public function index($project_key) {
->whereIn('status', [ 'active', 'waiting' ])
->orderBy('no', 'asc')
->get();
// compatible with old data
foreach ($sprints as $sprint)
{
if (!$sprint->name)
{
$sprint->name = 'Sprint ' . $sprint->no;
}
}

$epics = Epic::where('project_key', $project_key)
->orderBy('sn', 'asc')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CalendarController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function sync(Request $request)

$year = intval($year);

$url = 'http://www.actionview.cn:8080/api/holiday/' . $year;
$url = 'http://www.actionview.cn:8080/actionview/api/holiday/' . $year;

$res = CurlRequest::get($url);
if (!isset($res['ecode']) || $res['ecode'] != 0)
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/CommentsController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function store(Request $request, $project_key, $issue_id)
$id = DB::collection($table)->insertGetId(array_only($request->all(), [ 'contents', 'atWho' ]) + [ 'issue_id' => $issue_id, 'creator' => $creator, 'created_at' => time() ]);

// trigger event of comments added
Event::fire(new IssueEvent($project_key, $issue_id, $creator, [ 'event_key' => 'add_comments', 'data' => array_only($request->all(), [ 'contents', 'atWho' ]) ]));
Event::dispatch(new IssueEvent($project_key, $issue_id, $creator, [ 'event_key' => 'add_comments', 'data' => array_only($request->all(), [ 'contents', 'atWho' ]) ]));

$comments = DB::collection($table)->find($id);
return Response()->json([ 'ecode' => 0, 'data' => parent::arrange($comments) ]);
Expand Down Expand Up @@ -198,7 +198,7 @@ public function update(Request $request, $project_key, $issue_id, $id)
{
$event_key = 'edit_comments';
}
Event::fire(new IssueEvent($project_key, $issue_id, $user, [ 'event_key' => $event_key, 'data' => $changedComments ]));
Event::dispatch(new IssueEvent($project_key, $issue_id, $user, [ 'event_key' => $event_key, 'data' => $changedComments ]));

return Response()->json([ 'ecode' => 0, 'data' => parent::arrange(DB::collection($table)->find($id)) ]);
}
Expand Down Expand Up @@ -227,7 +227,7 @@ public function destroy($project_key, $issue_id, $id)

$user = [ 'id' => $this->user->id, 'name' => $this->user->first_name, 'email' => $this->user->email ];
// trigger the event of del comments
Event::fire(new IssueEvent($project_key, $issue_id, $user, [ 'event_key' => 'del_comments', 'data' => array_only($comments, [ 'contents', 'atWho' ]) ]));
Event::dispatch(new IssueEvent($project_key, $issue_id, $user, [ 'event_key' => 'del_comments', 'data' => array_only($comments, [ 'contents', 'atWho' ]) ]));

return Response()->json(['ecode' => 0, 'data' => ['id' => $id]]);
}
Expand Down
Empty file modified app/Http/Controllers/ConfigController.php
100644 → 100755
Empty file.
Loading