{"id":850,"date":"2024-01-05T23:59:50","date_gmt":"2024-01-05T14:59:50","guid":{"rendered":"https:\/\/web.cloudfree.jp\/journal\/?p=850"},"modified":"2024-01-10T20:41:47","modified_gmt":"2024-01-10T11:41:47","slug":"laravel%e3%81%ae%e6%9b%b4%e6%96%b0%e5%88%86%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e8%87%aa%e5%8b%95%e9%81%b8%e6%8a%9e%e3%81%97%e3%81%a6%e3%82%b5%e3%83%bc%e3%83%90%e3%81%b8%e3%81%82%e3%81%92","status":"publish","type":"post","link":"https:\/\/web.cloudfree.jp\/journal\/laravel%e3%81%ae%e6%9b%b4%e6%96%b0%e5%88%86%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e8%87%aa%e5%8b%95%e9%81%b8%e6%8a%9e%e3%81%97%e3%81%a6%e3%82%b5%e3%83%bc%e3%83%90%e3%81%b8%e3%81%82%e3%81%92\/","title":{"rendered":"Laravel\u306e\u66f4\u65b0\u5206\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u62bd\u51fa\u3057\u3066\u30b5\u30fc\u30d0\u3078\u3042\u3052\u308b(\u30ea\u30b9\u30c8\u7de8)"},"content":{"rendered":"<h3 class=\"wp-block-post-title\">Laravel\u306e\u66f4\u65b0\u5206\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u62bd\u51fa\u3057\u3066\u30b5\u30fc\u30d0\u3078\u3042\u3052\u308b(\u30ea\u30b9\u30c8\u7de8)<\/h3>\n\n\n<p class=\"has-tertiary-color has-text-color has-background has-small-font-size\" style=\"background-color:#8d8dd8;margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0\">2024-01-05 \u8a18\u8f09<br>\u6982\u8981 : Laravel\u306e\u66f4\u65b0\u5206\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u9078\u629e\u3057\u3066\u30b5\u30fc\u30d0\u3078\u3042\u3052\u308b(\u30ea\u30b9\u30c8\u7de8)<br>Keyword : Laravel, FTP, PHP, \u66f4\u65b0\u30ea\u30b9\u30c8, <\/p>\n\n\n\n<p>WordPress\u306f\u30b5\u30fc\u30d0\u3067\u66f4\u65b0\u3057\u3066\u3001\u5fc5\u8981\u3068\u3042\u3089\u3070\u30ed\u30fc\u30ab\u30eb\u306b\u30af\u30ed\u30fc\u30f3\u3092\u4f5c\u6210\u3057\u3066\u3001\u30c6\u30b9\u30c8\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u5bfe\u3057\u3066\u6700\u8fd1\u59cb\u3081\u305fLaravel\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306fartisan\u306e\u51e6\u7406\u304c\u30ed\u30fc\u30ab\u30eb\u3067\u3057\u304b\u884c\u3048\u306a\u3044\u306e\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u958b\u767a\u3092\u3059\u3059\u3081\u3066\u30b5\u30fc\u30d0\u3078\u3042\u3052\u308b\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<br>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u95a2\u3057\u3066\u306f\u66f4\u65b0\u5185\u5bb9\u306b\u3088\u3063\u3066\u30b1\u30fc\u30b9\u30d0\u30a4\u30b1\u30fc\u30b9\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002\u3053\u308c\u3082 migrate reset \u304c\u53ef\u80fd\u306a\u64cd\u4f5c\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u30b5\u30fc\u30d0\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u8fbc\u3093\u3067\u66f4\u65b0\u3092\u304b\u3051\u3066\u307e\u305f\u623b\u3059\u3001\u3068\u3044\u3046\u6d41\u308c\u304c\u306e\u57fa\u672c\u3067\u3059\u3002<br><br>\u3068\u308a\u3042\u3048\u305a\u66f4\u65b0\u306e\u3042\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u62bd\u51fa\u3059\u308b\u51e6\u7406\u3092PHP\uff0bFTP\u95a2\u6570\u3067\u4f5c\u6210\u3057\u307e\u3057\uff54\u3042\u3002\u4ee5\u524dWordpress\u306e\u3068\u304d\u306b\u66f8\u3044\u305f\u30b3\u30fc\u30c9\u304c\u3060\u3044\u305f\u3044\u305d\u306e\u307e\u307e\u4f7f\u3048\u307e\u3057\u305f\u3002<br><br><a href=\"https:\/\/web.cloudfree.jp\/journal\/php%e3%81%aeftp%e9%96%a2%e6%95%b0%e3%81%a7%e3%83%ad%e3%83%bc%e3%82%ab%e3%83%ab%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e3%82%b5%e3%83%bc%e3%83%90%e3%81%a8%e5%90%8c%e3%81%98%e3%81%ab%e3%81%99\/\" data-type=\"post\" data-id=\"815\">php\u306eFTP\u95a2\u6570\u3067\u30ed\u30fc\u30ab\u30eb\u30d5\u30a1\u30a4\u30eb\u3092\u30b5\u30fc\u30d0\u3068\u540c\u3058\u306b\u3059\u308b\u51e6\u7406\u3092\u8d70\u3089\u305b\u308b<\/a><br><br>ftp_mlsd\u304c\u3084\u306f\u308a\u5f37\u529b\u3067\u3001\u3053\u3053\u3067\u3082\u983c\u308a\u306e\u7db1\u3067\u3059\u3002<br>\u3068\u3053\u308d\u3067\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u66f4\u65b0\u65e5\u6642\u3068\u3044\u3046\u306e\u306f\u57fa\u672c\u66f8\u304d\u63db\u3048\u3067\u304d\u306a\u3044\u3093\u3067\u3059\u306d\u3002\u3053\u306e\u51e6\u7406\u3092\u66f8\u3044\u3066\u3044\u3066\u521d\u3081\u3066\u77e5\u308a\u307e\u3057\u305f\u3002\u3057\u304b\u3057FTP\u30bd\u30d5\u30c8\u3067\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u304c\u63c3\u3063\u3066\u3044\u308b\u306e\u898b\u305f\u3053\u3068\u3042\u308b\u3088\u3046\u306a\u306a\u3044\u3088\u3046\u306a\u3002<br><br>\u81a8\u5927\u306a\u30d5\u30a1\u30a4\u30eb\u7fa4\u306evender\u3092\u7701\u3044\u305f\u308a\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u3084test\u306f\u7121\u8996\u3057\u305f\u308a\u3068\u3001Laravel\u306b\u7279\u5316\u3057\u305f\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br>\u51e6\u7406\u306f\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u3067\u3059\u3002\u305d\u306e\u30ea\u30b9\u30c8\u306b\u5fdc\u3058\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u8ee2\u9001\u306f\u3069\u3046\u3059\u308b\u304b\u306f\u307e\u305f\u306e\u5bbf\u984c\u3002<br>\u5f53\u9762\u306f\u30c7\u30d0\u30c3\u30b0\u3068\u52c9\u5f37\u3092\u517c\u306d\u3066\u3001\u30ea\u30b9\u30c8\u898b\u306a\u304c\u3089FileZilla\u3067\u624b\u4f5c\u696d\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-lang=\"PHP\"><code>  mb_language(&#39;Japanese&#39;);\n  mb_internal_encoding(&#39;UTF-8&#39;);\n  date_default_timezone_set(&quot;Asia\/Tokyo&quot;);\n  setlocale(LC_ALL, &#39;ja_JP.UTF-8&#39;);\n\n  $sJobkey = $_GET[&#39;jobkey&#39;] ?? &#39;nop&#39;;\n\n  $cParam = array();\n  $cParam[&#39;dryrun&#39;] = &#39;no&#39;;\n\n  if ($sJobkey === &#39;nop&#39;) {\n  } elseif ($sJobkey === &#39;makelist_update_server_laravel&#39;) {\n\u3000\u3000\/\/FTP\u30b5\u30fc\u30d0\u63a5\u7d9a\u60c5\u5831\u3000\n    $cParam[&#39;base_path_src&#39;] = &#39;\/cfsid.cloudfree.jp\/public_html\/mywordpress\/&#39;;\n    $cParam[&#39;base_path_dest&#39;] = &#39;c:\/home\/cfsid\/cfsid.cloudfree.jp\/public_html\/mywordpress\/&#39;;\n    \/\/ftp-cloudfree\n    $ftp_cloudfree = getftp(&#39;svXX.cloudfree.ne.jp\/cfsid_ftpuser@cfsid.cloudfree.jp\/password&#39;);\n    ftp_chdir($ftp_cloudfree, $cParam[&#39;base_path_src&#39;]);\n    \/\/ftp-local\n    $ftp_local = getftp(&#39;localhost\/ftpuser\/password&#39;);\n    ftp_chdir($ftp_local, &#39;\/cloudfree_home\/cfsid\/cfsid.cloudfree.jp\/public_html\/mywordpress\/&#39;);\n\n    \/\/\u521d\u671f\u5316\n    $cParam[&#39;list&#39;] = [];\n    $cParam[&#39;except_folder&#39;] = [];\n    $cParam[&#39;except_list_preg_grep&#39;] = [];\n\n    \/\/\u8a2d\u5b9a\n    $cParam[&#39;subfolder&#39;] = &#39;yes&#39;;\n    \/\/?jobkey=makelist_update_server_laravel&mode=scanall_setting2_setting3\n    $cParam[&#39;scanall&#39;] = (strpos($sMode, &#39;scanall&#39;) === false) ? &#39;no&#39;: &#39;yes&#39;;\n    $cParam[&#39;except_folder&#39;] += [&#39;vendor\/&#39;, &#39;tests\/&#39;, &#39;storage\/framework\/&#39;, &#39;bootstrap\/cache\/&#39;];\n    $cParam[&#39;except_list_preg_grep&#39;] += [&#39;\/^\\.env\/&#39;, &#39;\/storage\\\/logs\\\/laravel\\.log\/&#39;];\n\n    \/\/\u30b5\u30fc\u30d0\u306b\u66f4\u65b0\u3092\u304b\u3051\u308b\u30d5\u30a1\u30a4\u30eb\u30ea\u30b9\u30c8\u4f5c\u6210\n    MakeList_NotEqual_MDTM($ftp_local, $ftp_cloudfree, &#39;&#39;, $cParam);\n    echo &#39;&lt;hr&gt;&#39;;\n    foreach ($cParam[&#39;list&#39;] as $item) {\n      echo $item.&quot;&lt;br&gt;\\n&quot;;\n    }\n\n    \/\/$ftp \u5f8c\u59cb\u672b\n    ftp_close($ftp_cloudfree);\n    ftp_close($ftp_local);\n  }\n\n  \/\/$cParam[&#39;list&#39;] \u7d50\u679c\u3092\u3053\u3053\u3078\u8ffd\u52a0\u683c\u7d0d\n  \/\/$cParam[&#39;subfolder&#39;]=&#39;yes&#39;\u306a\u3089\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u3082\u5bfe\u8c61\u3068\u3057\u518d\u5e30\u95a2\u6570\u3068\u3057\u3066\u4f5c\u52d5\u3059\u308b\n  function MakeList_NotEqual_MDTM($ftp_src, $ftp_dest, $sFolder, $cParam) {\n\n    $aList = ftp_mlsd($ftp_src, $sFolder);\n\n    \/\/\u203b \u30b5\u30fc\u30d0\u306b\u30d5\u30a9\u30eb\u30c0\u3054\u3068\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f \n    \/\/   ftp_mlsd($ftp_dest, $sFolder)\u306ffalse\u3092\u8fd4\u3057\u3001GetDic_mdtm\u306f\u3001[]\u3092\u8fd4\u3059\n    \/\/   \u305d\u308c\u3067 foreach\u5185\u306e $fExist \u306f false\u306b\u306a\u308b\u306e\u3067OK\n    $aList_dest_mdtm = GetDic_mdtm(ftp_mlsd($ftp_dest, $sFolder));\n\n    foreach($aList as $item) {\n      if ($item[&#39;type&#39;] == &#39;dir&#39; && $cParam[&#39;subfolder&#39;] == &#39;yes&#39;) {\n        if ($cParam[&#39;scanall&#39;] === &#39;yes&#39; || !in_array($sFolder.$item[&#39;name&#39;].&#39;\/&#39;, $cParam[&#39;except_folder&#39;])) {\n          \/\/\u7a2e\u985e=\u30d5\u30a9\u30eb\u30c0\u3067\u3001\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u542b\u3081\u308b\u3067\u3001\u9664\u5916\u30d5\u30a9\u30eb\u30c0\u306e\u5bfe\u8c61\u3067\u306a\u3044\u5834\u5408\n          MakeList_NotEqual_MDTM($ftp_src, $ftp_dest, $sFolder.$item[&#39;name&#39;].&#39;\/&#39;, $cParam);\n        }\n      } else if ($item[&#39;type&#39;] == &#39;file&#39;) {\n        $fExist = key_exists($item[&#39;name&#39;], $aList_dest_mdtm);\n        \/\/\u9664\u5916\u30d5\u30a1\u30a4\u30eb\u306e\u5bfe\u8c61\u3067\u306a\u3044\u304b\u3092\u78ba\u8a8d\n        if ($cParam[&#39;scanall&#39;] !== &#39;yes&#39;) {\n          foreach ($cParam[&#39;except_list_preg_grep&#39;] as $pattern) {\n            if (preg_match($pattern, $sFolder.$item[&#39;name&#39;])) {\n              if ($fExist) unset($aList_dest_mdtm[$item[&#39;name&#39;]]);\n              continue 2;\n            }\n          }\n        }\n        $src_mdtm = explode(&#39;.&#39;, $item[&#39;modify&#39;])[0];\n        if (!$fExist) {\n          \/\/Server\u306b\u306f\u306a\u3044\u30d5\u30a1\u30a4\u30eb\n          $sLine = &#39;[NEW_SRC]&#39;;\n        } elseif ($src_mdtm &gt; $aList_dest_mdtm[$item[&#39;name&#39;]]) { \n          $sLine = &#39;[UPD_SRC]&#39;;\n        } elseif ($src_mdtm &lt; $aList_dest_mdtm[$item[&#39;name&#39;]]) { \n          $sLine = &#39;[UPD_DST_!?!]&#39;;\n        } else {\n          \/\/\u66f4\u65b0\u65e5\u6642\u304c\u540c\u4e00\n          $sLine = &#39;&#39;;\n        }\n        if (strpos($sLine, &#39;]&#39;)) {\n          $sLine .= $sFolder.$item[&#39;name&#39;];\n          echo $sLine.&quot;&lt;br&gt;\\n&quot;;\n          $cParam[&#39;list&#39;][] = $sLine;\n        }\n        if ($fExist) unset($aList_dest_mdtm[$item[&#39;name&#39;]]);\n      }\n    }\n    \/\/\u30b5\u30fc\u30d0\u306e\u307f\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u3057\u3066\n    foreach(array_keys($aList_dest_mdtm) as $key) {\n      $sLine = &#39;[DEL_DST]&#39;.$sFolder.$key;\n      echo $sLine.&quot;&lt;br&gt;\\n&quot;;\n      $cParam[&#39;list&#39;][] = $sLine;\n    }\n  }\n\n  \/\/FTP\u30b5\u30fc\u30d0\u3078\u306e\u63a5\u7d9a\n  function getftp($sServerVal) {\n    $asServerVal = explode(&#39;\/&#39;, $sServerVal);\n    $ftp = ftp_connect($asServerVal[0]) or die(&quot;Couldn&#39;t connect to $asServerVal[0]&quot;);\n    ftp_login($ftp, $asServerVal[1], $asServerVal[2]) or die(&quot;Couldn&#39;t login&quot;);\n    return $ftp;\n  }\n\n  \/\/ \u6700\u7d42\u66f4\u65b0\u65e5\u6642\u3092&#39;Y-m-d H:i:s&#39;\u6587\u5b57\u5217\u3068\u3057\u3066\u53d6\u5f97\n  \/\/ &quot;20230401235900&quot;-&gt;&quot;2023-04-01 23:59:00&quot;\n  function date_mdtm($sYmdHis) {\n    $sYmdHis = explode(&#39;.&#39;, $sYmdHis)[0];\n    return DateTime::createFromFormat(&#39;YmdHis&#39;, $sYmdHis, new DateTimeZone(&#39;UTC&#39;))-&gt;format(&#39;Y-m-d H:i:s&#39;);\n  }\n\n  \/\/\u203b2023-12-24\u7248\u3088\u308a\u4e00\u90e8\u5909\u66f4\u3057\u307e\u3057\u305f\n  \/\/\u30ed\u30fc\u30ab\u30eb\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u7d42\u66f4\u65b0\u65e5\u6642\u3092\u30d5\u30a1\u30a4\u30eb\u540d\u3092key\u306b\u53d6\u5f97\u3059\u308b\u9023\u60f3\u914d\u5217\u3092\u8fd4\u3059\n  \/\/ echo Dic_mdtm[&#39;index.html&#39;]; \/\/ &#39;20230401235900&#39; \n  function GetDic_mdtm($aList_dest) {\n    $ret = [];\n    if ($aList_dest) {\n      \/\/ $aList_dest \u304cfalse(null)\u306b\u306a\u308b\u306e\u306f \u30d5\u30a9\u30eb\u30c0\u3054\u3068\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\n      foreach($aList_dest as $item) {\n        if ($item[&#39;type&#39;] === &#39;file&#39;) {\n          $ret[$item[&#39;name&#39;]] = $item[&#39;modify&#39;];\n        }\n      }\n    }\n    return $ret;\n  }\n<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30ed\u30fc\u30ab\u30eb\u3067\u958b\u767a\u3092\u3059\u3059\u3081\u3066\u3044\u304fLaravel\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3001\u30b5\u30fc\u30d0\u306b\u3042\u3052\u308b\u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u62bd\u51fa\u3059\u308b\u51e6\u7406\u3092PHP+FTP\u95a2\u6570\u3067\u4f5c\u6210\u3002<\/p>\n","protected":false},"author":1,"featured_media":814,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"wp-custom-template-x24-index","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[40,118,23,24],"_links":{"self":[{"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/posts\/850"}],"collection":[{"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/comments?post=850"}],"version-history":[{"count":0,"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/posts\/850\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/media\/814"}],"wp:attachment":[{"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/media?parent=850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/categories?post=850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.cloudfree.jp\/journal\/wp-json\/wp\/v2\/tags?post=850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}